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:
@@ -102,7 +102,7 @@ class CustomMultiChildLayoutExample extends StatelessWidget {
|
||||
),
|
||||
children: <Widget>[
|
||||
// Create all of the colored boxes in the colors map.
|
||||
for (MapEntry<String, Color> entry in _colors.entries)
|
||||
for (final MapEntry<String, Color> entry in _colors.entries)
|
||||
// The "id" can be any Object, not just a String.
|
||||
LayoutId(
|
||||
id: entry.key,
|
||||
|
||||
@@ -76,7 +76,7 @@ class _IndexedStackExampleState extends State<IndexedStackExample> {
|
||||
children: <Widget>[
|
||||
IndexedStack(
|
||||
index: index,
|
||||
children: <Widget>[for (String name in names) PersonTracker(name: name)],
|
||||
children: <Widget>[for (final String name in names) PersonTracker(name: name)],
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user