Enable library_private_types_in_public_api lint (#81578)
This commit is contained in:
committed by
GitHub
parent
b878b11f0c
commit
b8a2456737
@@ -5,7 +5,8 @@ include: ../../analysis_options.yaml
|
||||
|
||||
linter:
|
||||
rules:
|
||||
unawaited_futures: true
|
||||
curly_braces_in_flow_control_structures: true
|
||||
avoid_catches_without_on_clauses: true
|
||||
curly_braces_in_flow_control_structures: true
|
||||
library_private_types_in_public_api: false # Tool does not have any public API
|
||||
prefer_relative_imports: true
|
||||
unawaited_futures: true
|
||||
|
||||
@@ -271,7 +271,7 @@ class _Attribute extends _Entry {
|
||||
class ApkManifestData {
|
||||
ApkManifestData._(this._data);
|
||||
|
||||
static bool isAttributeWithValuePresent(_Element baseElement,
|
||||
static bool _isAttributeWithValuePresent(_Element baseElement,
|
||||
String childElement, String attributeName, String attributeValue) {
|
||||
final Iterable<_Element> allElements = baseElement.allElements(childElement);
|
||||
for (final _Element oneElement in allElements) {
|
||||
@@ -339,12 +339,12 @@ class ApkManifestData {
|
||||
}
|
||||
|
||||
for (final _Element element in intentFilters) {
|
||||
final bool isMainAction = isAttributeWithValuePresent(
|
||||
final bool isMainAction = _isAttributeWithValuePresent(
|
||||
element, 'action', 'android:name', '"android.intent.action.MAIN"');
|
||||
if (!isMainAction) {
|
||||
continue;
|
||||
}
|
||||
final bool isLauncherCategory = isAttributeWithValuePresent(
|
||||
final bool isLauncherCategory = _isAttributeWithValuePresent(
|
||||
element, 'category', 'android:name',
|
||||
'"android.intent.category.LAUNCHER"');
|
||||
if (!isLauncherCategory) {
|
||||
|
||||
@@ -347,7 +347,7 @@ List<String> _wrapTextAsLines(String text, {
|
||||
int? lastWhitespace;
|
||||
// Find the start of the current line.
|
||||
for (int index = 0; index < splitLine.length; ++index) {
|
||||
if (splitLine[index].character.isNotEmpty && isWhitespace(splitLine[index])) {
|
||||
if (splitLine[index].character.isNotEmpty && _isWhitespace(splitLine[index])) {
|
||||
lastWhitespace = index;
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ List<String> _wrapTextAsLines(String text, {
|
||||
result.add(joinRun(splitLine, currentLineStart, index));
|
||||
|
||||
// Skip any intervening whitespace.
|
||||
while (index < splitLine.length && isWhitespace(splitLine[index])) {
|
||||
while (index < splitLine.length && _isWhitespace(splitLine[index])) {
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ List<String> _wrapTextAsLines(String text, {
|
||||
/// character.
|
||||
///
|
||||
/// Based on: https://en.wikipedia.org/wiki/Whitespace_character#Unicode
|
||||
bool isWhitespace(_AnsiRun run) {
|
||||
bool _isWhitespace(_AnsiRun run) {
|
||||
final int rune = run.character.isNotEmpty ? run.character.codeUnitAt(0) : 0x0;
|
||||
return rune >= 0x0009 && rune <= 0x000D ||
|
||||
rune == 0x0020 ||
|
||||
|
||||
@@ -24,20 +24,20 @@ class FileStorage {
|
||||
}
|
||||
final int version = json['version'] as int;
|
||||
final List<Map<String, dynamic>> rawCachedFiles = (json['files'] as List<dynamic>).cast<Map<String, dynamic>>();
|
||||
final List<_FileHash> cachedFiles = <_FileHash>[
|
||||
for (final Map<String, dynamic> rawFile in rawCachedFiles) _FileHash._fromJson(rawFile),
|
||||
final List<FileHash> cachedFiles = <FileHash>[
|
||||
for (final Map<String, dynamic> rawFile in rawCachedFiles) FileHash._fromJson(rawFile),
|
||||
];
|
||||
return FileStorage(version, cachedFiles);
|
||||
}
|
||||
|
||||
final int version;
|
||||
final List<_FileHash> files;
|
||||
final List<FileHash> files;
|
||||
|
||||
List<int> toBuffer() {
|
||||
final Map<String, Object> json = <String, Object>{
|
||||
'version': version,
|
||||
'files': <Object>[
|
||||
for (final _FileHash file in files) file.toJson(),
|
||||
for (final FileHash file in files) file.toJson(),
|
||||
],
|
||||
};
|
||||
return utf8.encode(jsonEncode(json));
|
||||
@@ -45,14 +45,14 @@ class FileStorage {
|
||||
}
|
||||
|
||||
/// A stored file hash and path.
|
||||
class _FileHash {
|
||||
_FileHash(this.path, this.hash);
|
||||
class FileHash {
|
||||
FileHash(this.path, this.hash);
|
||||
|
||||
factory _FileHash._fromJson(Map<String, dynamic> json) {
|
||||
factory FileHash._fromJson(Map<String, dynamic> json) {
|
||||
if (!json.containsKey('path') || !json.containsKey('hash')) {
|
||||
throw Exception('File storage format invalid');
|
||||
}
|
||||
return _FileHash(json['path']! as String, json['hash']! as String);
|
||||
return FileHash(json['path']! as String, json['hash']! as String);
|
||||
}
|
||||
|
||||
final String path;
|
||||
@@ -142,7 +142,7 @@ class FileStore {
|
||||
_cacheFile.deleteSync();
|
||||
return;
|
||||
}
|
||||
for (final _FileHash fileHash in fileStorage.files) {
|
||||
for (final FileHash fileHash in fileStorage.files) {
|
||||
previousAssetKeys[fileHash.path] = fileHash.hash;
|
||||
}
|
||||
_logger.printTrace('Done initializing file store');
|
||||
@@ -154,9 +154,9 @@ class FileStore {
|
||||
if (!_cacheFile.existsSync()) {
|
||||
_cacheFile.createSync(recursive: true);
|
||||
}
|
||||
final List<_FileHash> fileHashes = <_FileHash>[];
|
||||
final List<FileHash> fileHashes = <FileHash>[];
|
||||
for (final MapEntry<String, String> entry in currentAssetKeys.entries) {
|
||||
fileHashes.add(_FileHash(entry.key, entry.value));
|
||||
fileHashes.add(FileHash(entry.key, entry.value));
|
||||
}
|
||||
final FileStorage fileStorage = FileStorage(
|
||||
_kVersion,
|
||||
|
||||
@@ -416,7 +416,7 @@ class DaemonDomain extends Domain {
|
||||
}
|
||||
}
|
||||
|
||||
typedef _RunOrAttach = Future<void> Function({
|
||||
typedef RunOrAttach = Future<void> Function({
|
||||
Completer<DebugConnectionInfo> connectionInfoCompleter,
|
||||
Completer<void> appStartedCompleter,
|
||||
});
|
||||
@@ -539,7 +539,7 @@ class AppDomain extends Domain {
|
||||
|
||||
Future<AppInstance> launch(
|
||||
ResidentRunner runner,
|
||||
_RunOrAttach runOrAttach,
|
||||
RunOrAttach runOrAttach,
|
||||
Device device,
|
||||
String projectDirectory,
|
||||
bool enableHotReload,
|
||||
|
||||
@@ -17,8 +17,8 @@ import '../globals.dart' as globals;
|
||||
import '../project.dart';
|
||||
|
||||
/// A request to the [TestCompiler] for recompilation.
|
||||
class _CompilationRequest {
|
||||
_CompilationRequest(this.mainUri, this.result);
|
||||
class CompilationRequest {
|
||||
CompilationRequest(this.mainUri, this.result);
|
||||
|
||||
Uri mainUri;
|
||||
Completer<String> result;
|
||||
@@ -61,8 +61,8 @@ class TestCompiler {
|
||||
});
|
||||
}
|
||||
|
||||
final StreamController<_CompilationRequest> compilerController = StreamController<_CompilationRequest>();
|
||||
final List<_CompilationRequest> compilationQueue = <_CompilationRequest>[];
|
||||
final StreamController<CompilationRequest> compilerController = StreamController<CompilationRequest>();
|
||||
final List<CompilationRequest> compilationQueue = <CompilationRequest>[];
|
||||
final FlutterProject flutterProject;
|
||||
final BuildInfo buildInfo;
|
||||
final String testFilePath;
|
||||
@@ -76,7 +76,7 @@ class TestCompiler {
|
||||
if (compilerController.isClosed) {
|
||||
return null;
|
||||
}
|
||||
compilerController.add(_CompilationRequest(mainDart, completer));
|
||||
compilerController.add(CompilationRequest(mainDart, completer));
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class TestCompiler {
|
||||
}
|
||||
|
||||
// Handle a compilation request.
|
||||
Future<void> _onCompilationRequest(_CompilationRequest request) async {
|
||||
Future<void> _onCompilationRequest(CompilationRequest request) async {
|
||||
final bool isEmpty = compilationQueue.isEmpty;
|
||||
compilationQueue.add(request);
|
||||
// Only trigger processing if queue was empty - i.e. no other requests
|
||||
@@ -127,7 +127,7 @@ class TestCompiler {
|
||||
return;
|
||||
}
|
||||
while (compilationQueue.isNotEmpty) {
|
||||
final _CompilationRequest request = compilationQueue.first;
|
||||
final CompilationRequest request = compilationQueue.first;
|
||||
globals.printTrace('Compiling ${request.mainUri}');
|
||||
final Stopwatch compilerTime = Stopwatch()..start();
|
||||
bool firstCompile = false;
|
||||
|
||||
Reference in New Issue
Block a user