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

@@ -77,7 +77,7 @@ class UndoableActionDispatcher extends ActionDispatcher implements Listenable {
/// May only be called by subclasses.
@protected
void notifyListeners() {
for (VoidCallback callback in _listeners) {
for (final VoidCallback callback in _listeners) {
callback();
}
}

View File

@@ -159,7 +159,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
setState(() {
final double dy = markersScrollOffset - notification.metrics.extentBefore;
markersScrollOffset = notification.metrics.extentBefore;
for (MarkerType type in markers.keys) {
for (final MarkerType type in markers.keys) {
final Offset oldPosition = markers[type];
markers[type] = oldPosition.translate(0.0, dy);
}
@@ -199,7 +199,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
),
),
),
for (MarkerType type in markers.keys)
for (final MarkerType type in markers.keys)
Marker(type: type, position: markers[type]),
],
);

View File

@@ -127,8 +127,8 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
if (_event.character != null) {
dataText.add(Text('character: ${_event.character}'));
}
for (ModifierKey modifier in data.modifiersPressed.keys) {
for (KeyboardSide side in KeyboardSide.values) {
for (final ModifierKey modifier in data.modifiersPressed.keys) {
for (final KeyboardSide side in KeyboardSide.values) {
if (data.isModifierPressed(modifier, side: side)) {
dataText.add(
Text('${_getEnumName(side)} ${_getEnumName(modifier).replaceAll('Modifier', '')} pressed'),

View File

@@ -343,7 +343,7 @@ class _FuzzerState extends State<Fuzzer> with SingleTickerProviderStateMixin {
if (node.children == null || node.children.isEmpty)
return 0;
int result = 0;
for (TextSpan child in node.children.cast<TextSpan>())
for (final TextSpan child in node.children.cast<TextSpan>())
result = math.max(result, depthOf(child));
return result;
}
@@ -582,7 +582,7 @@ class _UnderlinesState extends State<Underlines> {
child: ListBody(
children: <Widget>[
_wrap(null),
for (TextDecorationStyle style in TextDecorationStyle.values) _wrap(style),
for (final TextDecorationStyle style in TextDecorationStyle.values) _wrap(style),
],
),
),
@@ -675,7 +675,7 @@ class _FallbackState extends State<Fallback> {
child: IntrinsicWidth(
child: ListBody(
children: <Widget>[
for (String font in androidFonts)
for (final String font in androidFonts)
Text(
multiScript,
style: style.copyWith(