forked from firka/flutter
Update collection-fors to prefer final (as per updated prefer_final_in_for_each) (#127511)
The newly updated lint will soon flag for-each in collections. See discussion: https://github.com/dart-lang/linter/pull/4383 /cc @goderbauer
This commit is contained in:
@@ -930,7 +930,7 @@ Iterable<String> listApkPaths(
|
||||
];
|
||||
if (androidBuildInfo.splitPerAbi) {
|
||||
return <String>[
|
||||
for (AndroidArch androidArch in androidBuildInfo.targetArchs)
|
||||
for (final AndroidArch androidArch in androidBuildInfo.targetArchs)
|
||||
<String>[
|
||||
'app',
|
||||
androidArch.archName,
|
||||
|
||||
@@ -597,7 +597,7 @@ class ManifestAssetBundle implements AssetBundle {
|
||||
if (packageName == null)
|
||||
...manifest.fontsDescriptor
|
||||
else
|
||||
for (Font font in _parsePackageFonts(
|
||||
for (final Font font in _parsePackageFonts(
|
||||
manifest,
|
||||
packageName,
|
||||
packageConfig,
|
||||
|
||||
@@ -324,7 +324,7 @@ class BuildInfo {
|
||||
'-Pbundle-sksl-path=$bundleSkSLPath',
|
||||
if (codeSizeDirectory != null)
|
||||
'-Pcode-size-directory=$codeSizeDirectory',
|
||||
for (String projectArg in androidProjectArgs)
|
||||
for (final String projectArg in androidProjectArgs)
|
||||
'-P$projectArg',
|
||||
];
|
||||
if (dartDefineConfigJsonMap != null) {
|
||||
|
||||
@@ -178,7 +178,7 @@ class SourceVisitor implements ResolvedFiles {
|
||||
.getArtifactPath(artifact, platform: platform, mode: mode);
|
||||
if (environment.fileSystem.isDirectorySync(path)) {
|
||||
sources.addAll(<File>[
|
||||
for (FileSystemEntity entity in environment.fileSystem.directory(path).listSync(recursive: true))
|
||||
for (final FileSystemEntity entity in environment.fileSystem.directory(path).listSync(recursive: true))
|
||||
if (entity is File)
|
||||
entity,
|
||||
]);
|
||||
@@ -206,7 +206,7 @@ class SourceVisitor implements ResolvedFiles {
|
||||
final FileSystemEntity entity = environment.artifacts.getHostArtifact(artifact);
|
||||
if (entity is Directory) {
|
||||
sources.addAll(<File>[
|
||||
for (FileSystemEntity entity in entity.listSync(recursive: true))
|
||||
for (final FileSystemEntity entity in entity.listSync(recursive: true))
|
||||
if (entity is File)
|
||||
entity,
|
||||
]);
|
||||
|
||||
@@ -665,7 +665,7 @@ Future<void> _createStubAppFramework(File outputFile, Environment environment,
|
||||
await globals.xcode!.clang(<String>[
|
||||
'-x',
|
||||
'c',
|
||||
for (String arch in iosArchNames ?? <String>{}) ...<String>['-arch', arch],
|
||||
for (final String arch in iosArchNames ?? <String>{}) ...<String>['-arch', arch],
|
||||
stubSource.path,
|
||||
'-dynamiclib',
|
||||
// Keep version in sync with AOTSnapshotter flag
|
||||
|
||||
@@ -74,12 +74,12 @@ class GenerateLocalizationsTarget extends Target {
|
||||
<File>[
|
||||
configFile,
|
||||
if (inputs != null)
|
||||
for (Object inputFile in inputs.whereType<Object>())
|
||||
for (final Object inputFile in inputs.whereType<Object>())
|
||||
environment.fileSystem.file(inputFile),
|
||||
],
|
||||
<File>[
|
||||
if (outputs != null)
|
||||
for (Object outputFile in outputs.whereType<Object>())
|
||||
for (final Object outputFile in outputs.whereType<Object>())
|
||||
environment.fileSystem.file(outputFile),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1290,7 +1290,7 @@ String flattenNameSubdirs(Uri url, FileSystem fileSystem) {
|
||||
/// something that doesn't.
|
||||
String _flattenNameNoSubdirs(String fileName) {
|
||||
final List<int> replacedCodeUnits = <int>[
|
||||
for (int codeUnit in fileName.codeUnits)
|
||||
for (final int codeUnit in fileName.codeUnits)
|
||||
..._flattenNameSubstitutions[codeUnit] ?? <int>[codeUnit],
|
||||
];
|
||||
return String.fromCharCodes(replacedCodeUnits);
|
||||
|
||||
@@ -147,7 +147,7 @@ abstract class BuildFrameworkCommand extends BuildSubCommand {
|
||||
'xcrun',
|
||||
'xcodebuild',
|
||||
'-create-xcframework',
|
||||
for (Directory framework in frameworks) ...<String>[
|
||||
for (final Directory framework in frameworks) ...<String>[
|
||||
'-framework',
|
||||
framework.path,
|
||||
...framework.parent
|
||||
|
||||
@@ -682,7 +682,7 @@ Your $application code is in $relativeAppMain.
|
||||
|
||||
List<String> _getSupportedPlatformsFromTemplateContext(Map<String, Object?> templateContext) {
|
||||
return <String>[
|
||||
for (String platform in kAllCreatePlatforms)
|
||||
for (final String platform in kAllCreatePlatforms)
|
||||
if (templateContext[platform] == true) platform,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class LinuxDoctorValidator extends DoctorValidator {
|
||||
|
||||
final Map<String, _VersionInfo?> installedVersions = <String, _VersionInfo?>{
|
||||
// Sort the check to make the call order predictable for unit tests.
|
||||
for (String binary in _requiredBinaryVersions.keys.toList()..sort())
|
||||
for (final String binary in _requiredBinaryVersions.keys.toList()..sort())
|
||||
binary: await _getBinaryVersion(binary),
|
||||
};
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ void main() {
|
||||
FakeRequest(Uri.parse('http://localhost'), method: HttpMethod.put, responseError: const OSError('Connection Reset by peer')),
|
||||
FakeRequest(Uri.parse('http://localhost'), method: HttpMethod.put, responseError: const OSError('Connection Reset by peer')),
|
||||
// This is the value of `<int>[1, 2, 3, 4, 5]` run through `osUtils.gzipLevel1Stream`.
|
||||
FakeRequest(Uri.parse('http://localhost'), method: HttpMethod.put, body: <int>[for (List<int> chunk in expectedEncoded) ...chunk]),
|
||||
FakeRequest(Uri.parse('http://localhost'), method: HttpMethod.put, body: <int>[for (final List<int> chunk in expectedEncoded) ...chunk]),
|
||||
]),
|
||||
uploadRetryThrottle: Duration.zero,
|
||||
);
|
||||
|
||||
@@ -737,7 +737,7 @@ void main() {
|
||||
method: kListViewsMethod,
|
||||
jsonResponse: <String, Object>{
|
||||
'views': <Object>[
|
||||
for (FlutterView view in views) view.toJson(),
|
||||
for (final FlutterView view in views) view.toJson(),
|
||||
],
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user