enable lint prefer_final_in_for_each (#47724)

This commit is contained in:
Alexandre Ardhuin
2020-01-07 16:32:04 +01:00
committed by GitHub
parent fa337f5922
commit 4f9b6cf017
369 changed files with 1219 additions and 1220 deletions

View File

@@ -146,7 +146,7 @@ void generate(String commit) {
initialize();
final List<SampleInfo> samples = <SampleInfo>[];
for (FileSystemEntity entity in sampleDirectory.listSync()) {
for (final FileSystemEntity entity in sampleDirectory.listSync()) {
if (entity is File && entity.path.endsWith('.dart')) {
final SampleInfo sample = SampleInfo(entity, commit);
if (sample.initialize()) // skip files that lack the Sample Catalog comment
@@ -175,7 +175,7 @@ void generate(String commit) {
);
// Write the sample app files, like animated_list.md
for (SampleInfo sample in samples) {
for (final SampleInfo sample in samples) {
writeExpandedTemplate(
outputFile(sample.sourceName + '.md'),
inputFile('bin', 'sample_page.md.template').readAsStringSync(),
@@ -188,13 +188,13 @@ void generate(String commit) {
// that feature one class. For example AnimatedList_index.md would only
// include samples that had AnimatedList in their "Classes:" list.
final Map<String, List<SampleInfo>> classToSamples = <String, List<SampleInfo>>{};
for (SampleInfo sample in samples) {
for (String className in sample.highlightedClasses) {
for (final SampleInfo sample in samples) {
for (final String className in sample.highlightedClasses) {
classToSamples[className] ??= <SampleInfo>[];
classToSamples[className].add(sample);
}
}
for (String className in classToSamples.keys) {
for (final String className in classToSamples.keys) {
final Iterable<String> entries = classToSamples[className].map<String>((SampleInfo sample) {
return expandTemplate(entryTemplate, sample.commentValues);
});
@@ -238,7 +238,7 @@ void generate(String commit) {
// For now, the website's index.json file must be updated by hand.
logMessage('The following entries must appear in _data/catalog/widgets.json');
for (String className in classToSamples.keys)
for (final String className in classToSamples.keys)
logMessage('"sample": "${className}_index"');
}

View File

@@ -13,11 +13,11 @@ void main() {
await tester.pump();
// Initially only the top level EntryItems (the "chapters") are present.
for (Entry chapter in expansion_tile_sample.data) {
for (final Entry chapter in expansion_tile_sample.data) {
expect(find.text(chapter.title), findsOneWidget);
for (Entry section in chapter.children) {
for (final Entry section in chapter.children) {
expect(find.text(section.title), findsNothing);
for (Entry item in section.children)
for (final Entry item in section.children)
expect(find.text(item.title), findsNothing);
}
}
@@ -34,15 +34,15 @@ void main() {
// Expand the chapters. Now the chapter and sections, but not the
// items, should be present.
for (Entry chapter in expansion_tile_sample.data.reversed)
for (final Entry chapter in expansion_tile_sample.data.reversed)
await tapEntry(chapter.title);
for (Entry chapter in expansion_tile_sample.data) {
for (final Entry chapter in expansion_tile_sample.data) {
expect(find.text(chapter.title), findsOneWidget);
for (Entry section in chapter.children) {
for (final Entry section in chapter.children) {
expect(find.text(section.title), findsOneWidget);
await scrollUpOneEntry();
for (Entry item in section.children)
for (final Entry item in section.children)
expect(find.text(item.title), findsNothing);
}
await scrollUpOneEntry();
@@ -53,8 +53,8 @@ void main() {
await tester.pumpAndSettle();
// Expand the sections. Now Widgets for all three levels should be present.
for (Entry chapter in expansion_tile_sample.data) {
for (Entry section in chapter.children) {
for (final Entry chapter in expansion_tile_sample.data) {
for (final Entry section in chapter.children) {
await tapEntry(section.title);
await scrollUpOneEntry();
}
@@ -65,11 +65,11 @@ void main() {
// Working in reverse order, so we don't need to do anymore scrolling,
// check that everything is visible and close the sections and
// chapters as we go up.
for (Entry chapter in expansion_tile_sample.data.reversed) {
for (final Entry chapter in expansion_tile_sample.data.reversed) {
expect(find.text(chapter.title), findsOneWidget);
for (Entry section in chapter.children.reversed) {
for (final Entry section in chapter.children.reversed) {
expect(find.text(section.title), findsOneWidget);
for (Entry item in section.children.reversed)
for (final Entry item in section.children.reversed)
expect(find.text(item.title), findsOneWidget);
await tapEntry(section.title); // close the section
}
@@ -77,11 +77,11 @@ void main() {
}
// Finally only the top level EntryItems (the "chapters") are present.
for (Entry chapter in expansion_tile_sample.data) {
for (final Entry chapter in expansion_tile_sample.data) {
expect(find.text(chapter.title), findsOneWidget);
for (Entry section in chapter.children) {
for (final Entry section in chapter.children) {
expect(find.text(section.title), findsNothing);
for (Entry item in section.children)
for (final Entry item in section.children)
expect(find.text(item.title), findsNothing);
}
}