enable lint prefer_final_in_for_each (#47724)
diff --git a/packages/flutter/lib/src/animation/listener_helpers.dart b/packages/flutter/lib/src/animation/listener_helpers.dart
index 61203f8..e8d66c7 100644
--- a/packages/flutter/lib/src/animation/listener_helpers.dart
+++ b/packages/flutter/lib/src/animation/listener_helpers.dart
@@ -118,7 +118,7 @@
/// will not change which listeners are called during this iteration.
void notifyListeners() {
final List<VoidCallback> localListeners = List<VoidCallback>.from(_listeners);
- for (VoidCallback listener in localListeners) {
+ for (final VoidCallback listener in localListeners) {
try {
if (_listeners.contains(listener))
listener();
@@ -187,7 +187,7 @@
/// will not change which listeners are called during this iteration.
void notifyStatusListeners(AnimationStatus status) {
final List<AnimationStatusListener> localListeners = List<AnimationStatusListener>.from(_statusListeners);
- for (AnimationStatusListener listener in localListeners) {
+ for (final AnimationStatusListener listener in localListeners) {
try {
if (_statusListeners.contains(listener))
listener(status);
diff --git a/packages/flutter/lib/src/animation/tween_sequence.dart b/packages/flutter/lib/src/animation/tween_sequence.dart
index bb6fa5b..3d1712a 100644
--- a/packages/flutter/lib/src/animation/tween_sequence.dart
+++ b/packages/flutter/lib/src/animation/tween_sequence.dart
@@ -57,7 +57,7 @@
_items.addAll(items);
double totalWeight = 0.0;
- for (TweenSequenceItem<T> item in _items)
+ for (final TweenSequenceItem<T> item in _items)
totalWeight += item.weight;
assert(totalWeight > 0.0);
diff --git a/packages/flutter/lib/src/cupertino/date_picker.dart b/packages/flutter/lib/src/cupertino/date_picker.dart
index fab27b4..29c547f 100644
--- a/packages/flutter/lib/src/cupertino/date_picker.dart
+++ b/packages/flutter/lib/src/cupertino/date_picker.dart
@@ -1572,7 +1572,7 @@
// that has the biggest width.
// - If two different 1-digit numbers are of the same width, their corresponding
// 2 digit numbers are of the same width.
- for (String input in numbers) {
+ for (final String input in numbers) {
textPainter.text = TextSpan(
text: input,
style: textStyle,
diff --git a/packages/flutter/lib/src/cupertino/segmented_control.dart b/packages/flutter/lib/src/cupertino/segmented_control.dart
index 6a66b3d..fa72139 100644
--- a/packages/flutter/lib/src/cupertino/segmented_control.dart
+++ b/packages/flutter/lib/src/cupertino/segmented_control.dart
@@ -257,13 +257,13 @@
void _updateAnimationControllers() {
assert(mounted, 'This should only be called after didUpdateDependencies');
- for (AnimationController controller in _selectionControllers) {
+ for (final AnimationController controller in _selectionControllers) {
controller.dispose();
}
_selectionControllers.clear();
_childTweens.clear();
- for (T key in widget.children.keys) {
+ for (final T key in widget.children.keys) {
final AnimationController animationController = createAnimationController();
if (widget.groupValue == key) {
_childTweens.add(_reverseBackgroundColorTween);
@@ -294,7 +294,7 @@
if (oldWidget.groupValue != widget.groupValue) {
int index = 0;
- for (T key in widget.children.keys) {
+ for (final T key in widget.children.keys) {
if (widget.groupValue == key) {
_childTweens[index] = _forwardBackgroundColorTween;
_selectionControllers[index].forward();
@@ -309,7 +309,7 @@
@override
void dispose() {
- for (AnimationController animationController in _selectionControllers) {
+ for (final AnimationController animationController in _selectionControllers) {
animationController.dispose();
}
super.dispose();
@@ -364,7 +364,7 @@
int index = 0;
int selectedIndex;
int pressedIndex;
- for (T currentKey in widget.children.keys) {
+ for (final T currentKey in widget.children.keys) {
selectedIndex = (widget.groupValue == currentKey) ? index : selectedIndex;
pressedIndex = (_pressedKey == currentKey) ? index : pressedIndex;
@@ -629,7 +629,7 @@
double maxHeight = _kMinSegmentedControlHeight;
double childWidth = constraints.minWidth / childCount;
- for (RenderBox child in getChildrenAsList()) {
+ for (final RenderBox child in getChildrenAsList()) {
childWidth = math.max(childWidth, child.getMaxIntrinsicWidth(double.infinity));
}
childWidth = math.min(childWidth, constraints.maxWidth / childCount);
diff --git a/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart b/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart
index 2456693..78f68c6 100644
--- a/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart
+++ b/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart
@@ -301,7 +301,7 @@
vsync: this,
);
- for (T currentKey in widget.children.keys) {
+ for (final T currentKey in widget.children.keys) {
_highlightControllers[currentKey] = _createHighlightAnimationController(
isCompleted: currentKey == widget.groupValue, // Highlight the current selection.
);
@@ -314,7 +314,7 @@
super.didUpdateWidget(oldWidget);
// Update animation controllers.
- for (T oldKey in oldWidget.children.keys) {
+ for (final T oldKey in oldWidget.children.keys) {
if (!widget.children.containsKey(oldKey)) {
_highlightControllers[oldKey].dispose();
_pressControllers[oldKey].dispose();
@@ -324,7 +324,7 @@
}
}
- for (T newKey in widget.children.keys) {
+ for (final T newKey in widget.children.keys) {
if (!_highlightControllers.keys.contains(newKey)) {
_highlightControllers[newKey] = _createHighlightAnimationController();
_pressControllers[newKey] = _createFadeoutAnimationController();
@@ -336,11 +336,11 @@
@override
void dispose() {
- for (AnimationController animationController in _highlightControllers.values) {
+ for (final AnimationController animationController in _highlightControllers.values) {
animationController.dispose();
}
- for (AnimationController animationController in _pressControllers.values) {
+ for (final AnimationController animationController in _pressControllers.values) {
animationController.dispose();
}
@@ -413,7 +413,7 @@
]),
builder: (BuildContext context, Widget child) {
final List<Widget> children = <Widget>[];
- for (T currentKey in keys) {
+ for (final T currentKey in keys) {
final TextStyle textStyle = DefaultTextStyle.of(context).style.copyWith(
fontWeight: _highlightTween.evaluate(_highlightControllers[currentKey]),
);
@@ -829,7 +829,7 @@
double childWidth = (constraints.minWidth - totalSeparatorWidth) / childCount;
double maxHeight = _kMinSegmentedControlHeight;
- for (RenderBox child in getChildrenAsList()) {
+ for (final RenderBox child in getChildrenAsList()) {
childWidth = math.max(childWidth, child.getMaxIntrinsicWidth(double.infinity) + 2 * _kSegmentMinPadding);
}
@@ -999,7 +999,7 @@
final RRect thumbRRect = RRect.fromRectAndRadius(thumbRect.shift(offset), _kThumbRadius);
- for (BoxShadow shadow in thumbShadow) {
+ for (final BoxShadow shadow in thumbShadow) {
context.canvas.drawRRect(thumbRRect.shift(shadow.offset), shadow.toPaint());
}
diff --git a/packages/flutter/lib/src/cupertino/tab_scaffold.dart b/packages/flutter/lib/src/cupertino/tab_scaffold.dart
index 5e013a9..96c9b75 100644
--- a/packages/flutter/lib/src/cupertino/tab_scaffold.dart
+++ b/packages/flutter/lib/src/cupertino/tab_scaffold.dart
@@ -523,10 +523,10 @@
@override
void dispose() {
- for (FocusScopeNode focusScopeNode in tabFocusNodes) {
+ for (final FocusScopeNode focusScopeNode in tabFocusNodes) {
focusScopeNode.dispose();
}
- for (FocusScopeNode focusScopeNode in discardedNodes) {
+ for (final FocusScopeNode focusScopeNode in discardedNodes) {
focusScopeNode.dispose();
}
super.dispose();
diff --git a/packages/flutter/lib/src/cupertino/thumb_painter.dart b/packages/flutter/lib/src/cupertino/thumb_painter.dart
index 1925612..c5a56c1 100644
--- a/packages/flutter/lib/src/cupertino/thumb_painter.dart
+++ b/packages/flutter/lib/src/cupertino/thumb_painter.dart
@@ -79,7 +79,7 @@
Radius.circular(rect.shortestSide / 2.0),
);
- for (BoxShadow shadow in shadows)
+ for (final BoxShadow shadow in shadows)
canvas.drawRRect(rrect.shift(shadow.offset), shadow.toPaint());
canvas.drawRRect(
diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart
index 0c88184..7f4ffed 100644
--- a/packages/flutter/lib/src/foundation/assertions.dart
+++ b/packages/flutter/lib/src/foundation/assertions.dart
@@ -556,7 +556,7 @@
ErrorDescription('\nThe malformed error has ${summaries.length} summaries.'),
];
int i = 1;
- for (DiagnosticsNode summary in summaries) {
+ for (final DiagnosticsNode summary in summaries) {
message.add(DiagnosticsProperty<DiagnosticsNode>('Summary $i', summary, expandableValue : true));
i += 1;
}
@@ -683,7 +683,7 @@
final RegExp packageParser = RegExp(r'^([^:]+):(.+)$');
final List<String> result = <String>[];
final List<String> skipped = <String>[];
- for (String line in frames) {
+ for (final String line in frames) {
final Match match = stackParser.firstMatch(line);
if (match != null) {
assert(match.groupCount == 2);
@@ -834,7 +834,7 @@
return null;
}
Iterable<DiagnosticsNode> properties = builder.properties;
- for (DiagnosticPropertiesTransformer transformer in FlutterErrorDetails.propertiesTransformers) {
+ for (final DiagnosticPropertiesTransformer transformer in FlutterErrorDetails.propertiesTransformers) {
properties = transformer(properties);
}
return DiagnosticPropertiesBuilder.fromProperties(properties.toList());
diff --git a/packages/flutter/lib/src/foundation/change_notifier.dart b/packages/flutter/lib/src/foundation/change_notifier.dart
index 4174f0b..3f7cac3 100644
--- a/packages/flutter/lib/src/foundation/change_notifier.dart
+++ b/packages/flutter/lib/src/foundation/change_notifier.dart
@@ -200,7 +200,7 @@
assert(_debugAssertNotDisposed());
if (_listeners != null) {
final List<VoidCallback> localListeners = List<VoidCallback>.from(_listeners);
- for (VoidCallback listener in localListeners) {
+ for (final VoidCallback listener in localListeners) {
try {
if (_listeners.contains(listener))
listener();
diff --git a/packages/flutter/lib/src/foundation/collections.dart b/packages/flutter/lib/src/foundation/collections.dart
index 5fabaeb..9caeb50 100644
--- a/packages/flutter/lib/src/foundation/collections.dart
+++ b/packages/flutter/lib/src/foundation/collections.dart
@@ -26,7 +26,7 @@
return false;
if (identical(a, b))
return true;
- for (T value in a) {
+ for (final T value in a) {
if (!b.contains(value))
return false;
}
@@ -84,7 +84,7 @@
return false;
if (identical(a, b))
return true;
- for (T key in a.keys) {
+ for (final T key in a.keys) {
if (!b.containsKey(key) || b[key] != a[key]) {
return false;
}
diff --git a/packages/flutter/lib/src/foundation/consolidate_response.dart b/packages/flutter/lib/src/foundation/consolidate_response.dart
index f1f7700..a41d84a 100644
--- a/packages/flutter/lib/src/foundation/consolidate_response.dart
+++ b/packages/flutter/lib/src/foundation/consolidate_response.dart
@@ -115,7 +115,7 @@
}
_bytes = Uint8List(_contentLength);
int offset = 0;
- for (List<int> chunk in _chunks) {
+ for (final List<int> chunk in _chunks) {
_bytes.setRange(offset, offset + chunk.length, chunk);
offset += chunk.length;
}
diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart
index 5fa29c2..1045325 100644
--- a/packages/flutter/lib/src/foundation/diagnostics.dart
+++ b/packages/flutter/lib/src/foundation/diagnostics.dart
@@ -843,7 +843,7 @@
);
int i = 0;
final int length = lines.length;
- for (String line in lines) {
+ for (final String line in lines) {
i++;
_writeLine(
line,
@@ -1132,7 +1132,7 @@
const int maxLines = 25;
int lines = 0;
void visitor(DiagnosticsNode node) {
- for (DiagnosticsNode child in node.getChildren()) {
+ for (final DiagnosticsNode child in node.getChildren()) {
if (lines < maxLines) {
depth += 1;
descendants.add('$prefixOtherLines${" " * depth}$child');
@@ -2508,7 +2508,7 @@
// For a null value, it is omitted unless `includeEmtpy` is true and
// [ifEntryNull] contains a corresponding description.
Iterable<String> _formattedValues() sync* {
- for (MapEntry<String, T> entry in value.entries) {
+ for (final MapEntry<String, T> entry in value.entries) {
if (entry.value != null) {
yield entry.key;
}
diff --git a/packages/flutter/lib/src/foundation/licenses.dart b/packages/flutter/lib/src/foundation/licenses.dart
index fcda6ac..084b954 100644
--- a/packages/flutter/lib/src/foundation/licenses.dart
+++ b/packages/flutter/lib/src/foundation/licenses.dart
@@ -310,7 +310,7 @@
static Stream<LicenseEntry> get licenses async* {
if (_collectors == null)
return;
- for (LicenseEntryCollector collector in _collectors)
+ for (final LicenseEntryCollector collector in _collectors)
yield* collector();
}
diff --git a/packages/flutter/lib/src/gestures/arena.dart b/packages/flutter/lib/src/gestures/arena.dart
index 47046ee..d59ab63 100644
--- a/packages/flutter/lib/src/gestures/arena.dart
+++ b/packages/flutter/lib/src/gestures/arena.dart
@@ -256,7 +256,7 @@
assert(state.eagerWinner == null || state.eagerWinner == member);
assert(!state.isOpen);
_arenas.remove(pointer);
- for (GestureArenaMember rejectedMember in state.members) {
+ for (final GestureArenaMember rejectedMember in state.members) {
if (rejectedMember != member)
rejectedMember.rejectGesture(pointer);
}
diff --git a/packages/flutter/lib/src/gestures/binding.dart b/packages/flutter/lib/src/gestures/binding.dart
index 1a10df4..55e7174 100644
--- a/packages/flutter/lib/src/gestures/binding.dart
+++ b/packages/flutter/lib/src/gestures/binding.dart
@@ -193,7 +193,7 @@
}
return;
}
- for (HitTestEntry entry in hitTestResult.path) {
+ for (final HitTestEntry entry in hitTestResult.path) {
try {
entry.target.handleEvent(event.transformed(entry.transform), entry);
} catch (exception, stack) {
diff --git a/packages/flutter/lib/src/gestures/converter.dart b/packages/flutter/lib/src/gestures/converter.dart
index a93a262..0093c26 100644
--- a/packages/flutter/lib/src/gestures/converter.dart
+++ b/packages/flutter/lib/src/gestures/converter.dart
@@ -42,7 +42,7 @@
/// from physical coordinates to logical pixels. See the discussion at
/// [PointerEvent] for more details on the [PointerEvent] coordinate space.
static Iterable<PointerEvent> expand(Iterable<ui.PointerData> data, double devicePixelRatio) sync* {
- for (ui.PointerData datum in data) {
+ for (final ui.PointerData datum in data) {
final Offset position = Offset(datum.physicalX, datum.physicalY) / devicePixelRatio;
final Offset delta = Offset(datum.physicalDeltaX, datum.physicalDeltaY) / devicePixelRatio;
final double radiusMinor = _toLogicalPixels(datum.radiusMinor, devicePixelRatio);
diff --git a/packages/flutter/lib/src/gestures/mouse_tracking.dart b/packages/flutter/lib/src/gestures/mouse_tracking.dart
index 563b12b..c8e42c1 100644
--- a/packages/flutter/lib/src/gestures/mouse_tracking.dart
+++ b/packages/flutter/lib/src/gestures/mouse_tracking.dart
@@ -410,7 +410,7 @@
// We can safely use `_mouseStates` here without worrying about the removed
// state, because `targetEvent` should be null when `_mouseStates` is used.
final Iterable<_MouseState> dirtyStates = targetEvent == null ? _mouseStates.values : <_MouseState>[targetState];
- for (_MouseState dirtyState in dirtyStates) {
+ for (final _MouseState dirtyState in dirtyStates) {
final LinkedHashSet<MouseTrackerAnnotation> nextAnnotations = _findAnnotations(dirtyState);
final LinkedHashSet<MouseTrackerAnnotation> lastAnnotations = dirtyState.replaceAnnotations(nextAnnotations);
handleUpdatedDevice(dirtyState, lastAnnotations);
diff --git a/packages/flutter/lib/src/gestures/multitap.dart b/packages/flutter/lib/src/gestures/multitap.dart
index 57e9a7b..ed31657 100644
--- a/packages/flutter/lib/src/gestures/multitap.dart
+++ b/packages/flutter/lib/src/gestures/multitap.dart
@@ -505,7 +505,7 @@
@override
void dispose() {
final List<_TapGesture> localGestures = List<_TapGesture>.from(_gestureMap.values);
- for (_TapGesture gesture in localGestures)
+ for (final _TapGesture gesture in localGestures)
gesture.cancel();
// Rejection of each gesture should cause it to be removed from our map
assert(_gestureMap.isEmpty);
diff --git a/packages/flutter/lib/src/gestures/recognizer.dart b/packages/flutter/lib/src/gestures/recognizer.dart
index 3b988c1..af81933 100644
--- a/packages/flutter/lib/src/gestures/recognizer.dart
+++ b/packages/flutter/lib/src/gestures/recognizer.dart
@@ -251,7 +251,7 @@
void resolve(GestureDisposition disposition) {
final List<GestureArenaEntry> localEntries = List<GestureArenaEntry>.from(_entries.values);
_entries.clear();
- for (GestureArenaEntry entry in localEntries)
+ for (final GestureArenaEntry entry in localEntries)
entry.resolve(disposition);
}
@@ -270,7 +270,7 @@
@override
void dispose() {
resolve(GestureDisposition.rejected);
- for (int pointer in _trackedPointers)
+ for (final int pointer in _trackedPointers)
GestureBinding.instance.pointerRouter.removeRoute(pointer, handleEvent);
_trackedPointers.clear();
assert(_entries.isEmpty);
diff --git a/packages/flutter/lib/src/gestures/scale.dart b/packages/flutter/lib/src/gestures/scale.dart
index 83b996a..bf5d959 100644
--- a/packages/flutter/lib/src/gestures/scale.dart
+++ b/packages/flutter/lib/src/gestures/scale.dart
@@ -338,7 +338,7 @@
// Compute the focal point
Offset focalPoint = Offset.zero;
- for (int pointer in _pointerLocations.keys)
+ for (final int pointer in _pointerLocations.keys)
focalPoint += _pointerLocations[pointer];
_currentFocalPoint = count > 0 ? focalPoint / count.toDouble() : Offset.zero;
@@ -348,7 +348,7 @@
double totalDeviation = 0.0;
double totalHorizontalDeviation = 0.0;
double totalVerticalDeviation = 0.0;
- for (int pointer in _pointerLocations.keys) {
+ for (final int pointer in _pointerLocations.keys) {
totalDeviation += (_currentFocalPoint - _pointerLocations[pointer]).distance;
totalHorizontalDeviation += (_currentFocalPoint.dx - _pointerLocations[pointer].dx).abs();
totalVerticalDeviation += (_currentFocalPoint.dy - _pointerLocations[pointer].dy).abs();
diff --git a/packages/flutter/lib/src/gestures/team.dart b/packages/flutter/lib/src/gestures/team.dart
index 2dcdd73..128a323 100644
--- a/packages/flutter/lib/src/gestures/team.dart
+++ b/packages/flutter/lib/src/gestures/team.dart
@@ -34,7 +34,7 @@
assert(_winner != null || _members.isNotEmpty);
_close();
_winner ??= _owner.captain ?? _members[0];
- for (GestureArenaMember member in _members) {
+ for (final GestureArenaMember member in _members) {
if (member != _winner)
member.rejectGesture(pointer);
}
@@ -45,7 +45,7 @@
void rejectGesture(int pointer) {
assert(_pointer == pointer);
_close();
- for (GestureArenaMember member in _members)
+ for (final GestureArenaMember member in _members)
member.rejectGesture(pointer);
}
diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart
index 55e7e58..44fc539 100644
--- a/packages/flutter/lib/src/material/about.dart
+++ b/packages/flutter/lib/src/material/about.dart
@@ -488,7 +488,7 @@
debugFlowId = flow.id;
return true;
}());
- await for (LicenseEntry license in LicenseRegistry.licenses) {
+ await for (final LicenseEntry license in LicenseRegistry.licenses) {
if (!mounted) {
return;
}
@@ -523,7 +523,7 @@
textAlign: TextAlign.center,
),
));
- for (LicenseParagraph paragraph in paragraphs) {
+ for (final LicenseParagraph paragraph in paragraphs) {
if (paragraph.indent == LicenseParagraph.centeredIndent) {
_licenses.add(Padding(
padding: const EdgeInsets.only(top: 16.0),
diff --git a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart
index 4c7d9b1..97366e4 100644
--- a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart
+++ b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart
@@ -162,7 +162,7 @@
}
final double clampedProgress = progress.value.clamp(0.0, 1.0) as double;
- for (_PathFrames path in paths)
+ for (final _PathFrames path in paths)
path.paint(canvas, color, uiPathFactory, clampedProgress);
}
@@ -203,7 +203,7 @@
..style = PaintingStyle.fill
..color = color.withOpacity(color.opacity * opacity);
final ui.Path path = uiPathFactory();
- for (_PathCommand command in commands)
+ for (final _PathCommand command in commands)
command.apply(path, progress);
canvas.drawPath(path, paint);
}
diff --git a/packages/flutter/lib/src/material/arc.dart b/packages/flutter/lib/src/material/arc.dart
index b6bf4ab..94ddec0 100644
--- a/packages/flutter/lib/src/material/arc.dart
+++ b/packages/flutter/lib/src/material/arc.dart
@@ -199,7 +199,7 @@
T _maxBy<T>(Iterable<T> input, _KeyFunc<T> keyFunc) {
T maxValue;
double maxKey;
- for (T value in input) {
+ for (final T value in input) {
final double key = keyFunc(value);
if (maxKey == null || key > maxKey) {
maxValue = value;
diff --git a/packages/flutter/lib/src/material/bottom_navigation_bar.dart b/packages/flutter/lib/src/material/bottom_navigation_bar.dart
index 9ea673d..2b68567 100644
--- a/packages/flutter/lib/src/material/bottom_navigation_bar.dart
+++ b/packages/flutter/lib/src/material/bottom_navigation_bar.dart
@@ -670,9 +670,9 @@
static final Animatable<double> _flexTween = Tween<double>(begin: 1.0, end: 1.5);
void _resetState() {
- for (AnimationController controller in _controllers)
+ for (final AnimationController controller in _controllers)
controller.dispose();
- for (_Circle circle in _circles)
+ for (final _Circle circle in _circles)
circle.dispose();
_circles.clear();
@@ -708,9 +708,9 @@
@override
void dispose() {
- for (AnimationController controller in _controllers)
+ for (final AnimationController controller in _controllers)
controller.dispose();
- for (_Circle circle in _circles)
+ for (final _Circle circle in _circles)
circle.dispose();
super.dispose();
}
@@ -984,7 +984,7 @@
@override
void paint(Canvas canvas, Size size) {
- for (_Circle circle in circles) {
+ for (final _Circle circle in circles) {
final Paint paint = Paint()..color = circle.color;
final Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.height);
canvas.clipRect(rect);
diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart
index 85b0e35..9ac390e 100644
--- a/packages/flutter/lib/src/material/chip.dart
+++ b/packages/flutter/lib/src/material/chip.dart
@@ -216,7 +216,7 @@
/// ];
///
/// Iterable<Widget> get actorWidgets sync* {
- /// for (Actor actor in _cast) {
+ /// for (final Actor actor in _cast) {
/// yield Padding(
/// padding: const EdgeInsets.all(4.0),
/// child: Chip(
@@ -1056,7 +1056,7 @@
/// List<String> _filters = <String>[];
///
/// Iterable<Widget> get actorWidgets sync* {
-/// for (ActorFilterEntry actor in _cast) {
+/// for (final ActorFilterEntry actor in _cast) {
/// yield Padding(
/// padding: const EdgeInsets.all(4.0),
/// child: FilterChip(
@@ -2316,7 +2316,7 @@
@override
void attach(PipelineOwner owner) {
super.attach(owner);
- for (RenderBox child in _children) {
+ for (final RenderBox child in _children) {
child.attach(owner);
}
}
@@ -2324,7 +2324,7 @@
@override
void detach() {
super.detach();
- for (RenderBox child in _children) {
+ for (final RenderBox child in _children) {
child.detach();
}
}
diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart
index 3f87bfc..b224aa12 100644
--- a/packages/flutter/lib/src/material/data_table.dart
+++ b/packages/flutter/lib/src/material/data_table.dart
@@ -454,7 +454,7 @@
if (onSelectAll != null) {
onSelectAll(checked);
} else {
- for (DataRow row in rows) {
+ for (final DataRow row in rows) {
if ((row.onSelectChanged != null) && (row.selected != checked))
row.onSelectChanged(checked);
}
@@ -648,7 +648,7 @@
onCheckboxChanged: _handleSelectAll,
);
rowIndex = 1;
- for (DataRow row in rows) {
+ for (final DataRow row in rows) {
tableRows[rowIndex].children[0] = _buildCheckbox(
color: theme.accentColor,
checked: row.selected,
@@ -699,7 +699,7 @@
ascending: sortAscending,
);
rowIndex = 1;
- for (DataRow row in rows) {
+ for (final DataRow row in rows) {
final DataCell cell = row.cells[dataColumnIndex];
tableRows[rowIndex].children[displayColumnIndex] = _buildDataCell(
context: context,
diff --git a/packages/flutter/lib/src/material/expansion_panel.dart b/packages/flutter/lib/src/material/expansion_panel.dart
index 6a8df6b..3f56eb4 100644
--- a/packages/flutter/lib/src/material/expansion_panel.dart
+++ b/packages/flutter/lib/src/material/expansion_panel.dart
@@ -389,7 +389,7 @@
bool _allIdentifiersUnique() {
final Map<Object, bool> identifierMap = <Object, bool>{};
- for (ExpansionPanelRadio child in widget.children.cast<ExpansionPanelRadio>()) {
+ for (final ExpansionPanelRadio child in widget.children.cast<ExpansionPanelRadio>()) {
identifierMap[child.value] = true;
}
return identifierMap.length == widget.children.length;
@@ -427,7 +427,7 @@
}
ExpansionPanelRadio searchPanelByValue(List<ExpansionPanelRadio> panels, Object value) {
- for (ExpansionPanelRadio panel in panels) {
+ for (final ExpansionPanelRadio panel in panels) {
if (panel.value == value)
return panel;
}
diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart
index 6474842..4fb38db 100644
--- a/packages/flutter/lib/src/material/ink_well.dart
+++ b/packages/flutter/lib/src/material/ink_well.dart
@@ -737,12 +737,12 @@
if (_splashes != null) {
final Set<InteractiveInkFeature> splashes = _splashes;
_splashes = null;
- for (InteractiveInkFeature splash in splashes)
+ for (final InteractiveInkFeature splash in splashes)
splash.dispose();
_currentSplash = null;
}
assert(_currentSplash == null);
- for (_HighlightType highlight in _highlights.keys) {
+ for (final _HighlightType highlight in _highlights.keys) {
_highlights[highlight]?.dispose();
_highlights[highlight] = null;
}
@@ -768,7 +768,7 @@
Widget build(BuildContext context) {
assert(widget.debugCheckContext(context));
super.build(context); // See AutomaticKeepAliveClientMixin.
- for (_HighlightType type in _highlights.keys) {
+ for (final _HighlightType type in _highlights.keys) {
_highlights[type]?.color = getHighlightColorForType(type);
}
_currentSplash?.color = widget.splashColor ?? Theme.of(context).splashColor;
diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart
index 1ce7920..e868c6a 100644
--- a/packages/flutter/lib/src/material/input_decorator.dart
+++ b/packages/flutter/lib/src/material/input_decorator.dart
@@ -805,14 +805,14 @@
@override
void attach(PipelineOwner owner) {
super.attach(owner);
- for (RenderBox child in _children)
+ for (final RenderBox child in _children)
child.attach(owner);
}
@override
void detach() {
super.detach();
- for (RenderBox child in _children)
+ for (final RenderBox child in _children)
child.detach();
}
@@ -1199,7 +1199,7 @@
double _lineHeight(double width, List<RenderBox> boxes) {
double height = 0.0;
- for (RenderBox box in boxes) {
+ for (final RenderBox box in boxes) {
if (box == null)
continue;
height = math.max(_minHeight(box, width), height);
@@ -1448,7 +1448,7 @@
@override
bool hitTestChildren(BoxHitTestResult result, { @required Offset position }) {
assert(position != null);
- for (RenderBox child in _children) {
+ for (final RenderBox child in _children) {
// TODO(hansmuller): label must be handled specially since we've transformed it
final Offset offset = _boxParentData(child).offset;
final bool isHit = result.addWithPaintOffset(
diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart
index 93836a2..80eadc3 100644
--- a/packages/flutter/lib/src/material/list_tile.dart
+++ b/packages/flutter/lib/src/material/list_tile.dart
@@ -1209,14 +1209,14 @@
@override
void attach(PipelineOwner owner) {
super.attach(owner);
- for (RenderBox child in _children)
+ for (final RenderBox child in _children)
child.attach(owner);
}
@override
void detach() {
super.detach();
- for (RenderBox child in _children)
+ for (final RenderBox child in _children)
child.detach();
}
@@ -1479,7 +1479,7 @@
@override
bool hitTestChildren(BoxHitTestResult result, { @required Offset position }) {
assert(position != null);
- for (RenderBox child in _children) {
+ for (final RenderBox child in _children) {
final BoxParentData parentData = child.parentData as BoxParentData;
final bool isHit = result.addWithPaintOffset(
offset: parentData.offset,
diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart
index 6795424..39f3d2a 100644
--- a/packages/flutter/lib/src/material/material.dart
+++ b/packages/flutter/lib/src/material/material.dart
@@ -524,7 +524,7 @@
canvas.save();
canvas.translate(offset.dx, offset.dy);
canvas.clipRect(Offset.zero & size);
- for (InkFeature inkFeature in _inkFeatures)
+ for (final InkFeature inkFeature in _inkFeatures)
inkFeature._paint(canvas);
canvas.restore();
}
diff --git a/packages/flutter/lib/src/material/mergeable_material.dart b/packages/flutter/lib/src/material/mergeable_material.dart
index b87251f..e60d5fa 100644
--- a/packages/flutter/lib/src/material/mergeable_material.dart
+++ b/packages/flutter/lib/src/material/mergeable_material.dart
@@ -204,7 +204,7 @@
@override
void dispose() {
- for (MergeableMaterialItem child in _children) {
+ for (final MergeableMaterialItem child in _children) {
if (child is MaterialGap)
_animationTuples[child.key].controller.dispose();
}
@@ -687,7 +687,7 @@
List<BoxShadow> boxShadows;
void _paintShadows(Canvas canvas, Rect rect) {
- for (BoxShadow boxShadow in boxShadows) {
+ for (final BoxShadow boxShadow in boxShadows) {
final Paint paint = boxShadow.toPaint();
// TODO(dragostis): Right now, we are only interpolating the border radii
// of the visible Material slices, not the shadows; they are not getting
diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart
index 5a3f2c7..e1b8678 100644
--- a/packages/flutter/lib/src/material/scaffold.dart
+++ b/packages/flutter/lib/src/material/scaffold.dart
@@ -2113,7 +2113,7 @@
_snackBarTimer?.cancel();
_snackBarTimer = null;
_geometryNotifier.dispose();
- for (_StandardBottomSheet bottomSheet in _dismissedBottomSheets) {
+ for (final _StandardBottomSheet bottomSheet in _dismissedBottomSheets) {
bottomSheet.animationController?.dispose();
}
if (_currentBottomSheet != null) {
diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart
index cc159d0..740c085 100644
--- a/packages/flutter/lib/src/material/tabs.dart
+++ b/packages/flutter/lib/src/material/tabs.dart
@@ -750,7 +750,7 @@
/// [AppBar] uses this size to compute its own preferred size.
@override
Size get preferredSize {
- for (Widget item in tabs) {
+ for (final Widget item in tabs) {
if (item is Tab) {
final Tab tab = item;
if (tab.text != null && tab.icon != null)
diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart
index b02f691..d6ddd70 100644
--- a/packages/flutter/lib/src/material/time_picker.dart
+++ b/packages/flutter/lib/src/material/time_picker.dart
@@ -685,7 +685,7 @@
void _positionPivoted(double width, double y, Map<_TimePickerHeaderId, Size> childSizes, List<_TimePickerHeaderFragment> fragments, int pivotIndex) {
double tailWidth = childSizes[fragments[pivotIndex].layoutId].width / 2.0;
- for (_TimePickerHeaderFragment fragment in fragments.skip(pivotIndex + 1)) {
+ for (final _TimePickerHeaderFragment fragment in fragments.skip(pivotIndex + 1)) {
tailWidth += childSizes[fragment.layoutId].width + fragment.startMargin;
}
@@ -703,7 +703,7 @@
void _positionPiece(double width, double centeredAroundY, Map<_TimePickerHeaderId, Size> childSizes, List<_TimePickerHeaderFragment> fragments) {
double pieceWidth = 0.0;
double nextMargin = 0.0;
- for (_TimePickerHeaderFragment fragment in fragments) {
+ for (final _TimePickerHeaderFragment fragment in fragments) {
final Size childSize = childSizes[fragment.layoutId];
pieceWidth += childSize.width + nextMargin;
// Delay application of margin until next element because margin of the
@@ -927,7 +927,7 @@
final double labelThetaIncrement = -_kTwoPi / labels.length;
double labelTheta = math.pi / 2.0;
- for (_TappableLabel label in labels) {
+ for (final _TappableLabel label in labels) {
final TextPainter labelPainter = label.painter;
final Offset labelOffset = Offset(-labelPainter.width / 2.0, -labelPainter.height / 2.0);
labelPainter.paint(canvas, getOffsetForTheta(labelTheta, ring) + labelOffset);
@@ -1339,7 +1339,7 @@
}
List<_TappableLabel> _build24HourInnerRing(TextTheme textTheme) => <_TappableLabel>[
- for (TimeOfDay timeOfDay in _amHours)
+ for (final TimeOfDay timeOfDay in _amHours)
_buildTappableLabel(
textTheme,
timeOfDay.hour,
@@ -1351,7 +1351,7 @@
];
List<_TappableLabel> _build24HourOuterRing(TextTheme textTheme) => <_TappableLabel>[
- for (TimeOfDay timeOfDay in _pmHours)
+ for (final TimeOfDay timeOfDay in _pmHours)
_buildTappableLabel(
textTheme,
timeOfDay.hour,
@@ -1363,7 +1363,7 @@
];
List<_TappableLabel> _build12HourOuterRing(TextTheme textTheme) => <_TappableLabel>[
- for (TimeOfDay timeOfDay in _amHours)
+ for (final TimeOfDay timeOfDay in _amHours)
_buildTappableLabel(
textTheme,
timeOfDay.hour,
@@ -1391,7 +1391,7 @@
];
return <_TappableLabel>[
- for (TimeOfDay timeOfDay in _minuteMarkerValues)
+ for (final TimeOfDay timeOfDay in _minuteMarkerValues)
_buildTappableLabel(
textTheme,
timeOfDay.minute,
diff --git a/packages/flutter/lib/src/painting/binding.dart b/packages/flutter/lib/src/painting/binding.dart
index 8adac80..cbdb882 100644
--- a/packages/flutter/lib/src/painting/binding.dart
+++ b/packages/flutter/lib/src/painting/binding.dart
@@ -128,7 +128,7 @@
final Set<VoidCallback> _systemFontsCallbacks = <VoidCallback>{};
void notifyListeners () {
- for (VoidCallback callback in _systemFontsCallbacks) {
+ for (final VoidCallback callback in _systemFontsCallbacks) {
callback();
}
}
diff --git a/packages/flutter/lib/src/painting/borders.dart b/packages/flutter/lib/src/painting/borders.dart
index 5725e3e..f5517c8 100644
--- a/packages/flutter/lib/src/painting/borders.dart
+++ b/packages/flutter/lib/src/painting/borders.dart
@@ -603,7 +603,7 @@
@override
void paint(Canvas canvas, Rect rect, { TextDirection textDirection }) {
- for (ShapeBorder border in borders) {
+ for (final ShapeBorder border in borders) {
border.paint(canvas, rect, textDirection: textDirection);
rect = border.dimensions.resolve(textDirection).deflateRect(rect);
}
diff --git a/packages/flutter/lib/src/painting/box_decoration.dart b/packages/flutter/lib/src/painting/box_decoration.dart
index bb3b7b4..95ec70f 100644
--- a/packages/flutter/lib/src/painting/box_decoration.dart
+++ b/packages/flutter/lib/src/painting/box_decoration.dart
@@ -433,7 +433,7 @@
void _paintShadows(Canvas canvas, Rect rect, TextDirection textDirection) {
if (_decoration.boxShadow == null)
return;
- for (BoxShadow boxShadow in _decoration.boxShadow) {
+ for (final BoxShadow boxShadow in _decoration.boxShadow) {
final Paint paint = boxShadow.toPaint();
final Rect bounds = rect.shift(boxShadow.offset).inflate(boxShadow.spreadRadius);
_paintBox(canvas, bounds, paint, textDirection);
diff --git a/packages/flutter/lib/src/painting/decoration_image.dart b/packages/flutter/lib/src/painting/decoration_image.dart
index 69b3597..e7dfe17 100644
--- a/packages/flutter/lib/src/painting/decoration_image.dart
+++ b/packages/flutter/lib/src/painting/decoration_image.dart
@@ -443,14 +443,14 @@
if (repeat == ImageRepeat.noRepeat) {
canvas.drawImageRect(image, sourceRect, destinationRect, paint);
} else {
- for (Rect tileRect in _generateImageTileRects(rect, destinationRect, repeat))
+ for (final Rect tileRect in _generateImageTileRects(rect, destinationRect, repeat))
canvas.drawImageRect(image, sourceRect, tileRect, paint);
}
} else {
if (repeat == ImageRepeat.noRepeat) {
canvas.drawImageNine(image, centerSlice, destinationRect, paint);
} else {
- for (Rect tileRect in _generateImageTileRects(rect, destinationRect, repeat))
+ for (final Rect tileRect in _generateImageTileRects(rect, destinationRect, repeat))
canvas.drawImageNine(image, centerSlice, tileRect, paint);
}
}
diff --git a/packages/flutter/lib/src/painting/image_resolution.dart b/packages/flutter/lib/src/painting/image_resolution.dart
index fcc0bd7..17e6eb8 100644
--- a/packages/flutter/lib/src/painting/image_resolution.dart
+++ b/packages/flutter/lib/src/painting/image_resolution.dart
@@ -233,7 +233,7 @@
return main;
// TODO(ianh): Consider moving this parsing logic into _manifestParser.
final SplayTreeMap<double, String> mapping = SplayTreeMap<double, String>();
- for (String candidate in candidates)
+ for (final String candidate in candidates)
mapping[_parseScale(candidate)] = candidate;
// TODO(ianh): implement support for config.locale, config.textDirection,
// config.size, config.platform (then document this over in the Image.asset
diff --git a/packages/flutter/lib/src/painting/image_stream.dart b/packages/flutter/lib/src/painting/image_stream.dart
index 82e62a7..4b062f9 100644
--- a/packages/flutter/lib/src/painting/image_stream.dart
+++ b/packages/flutter/lib/src/painting/image_stream.dart
@@ -402,7 +402,7 @@
// Make a copy to allow for concurrent modification.
final List<ImageStreamListener> localListeners =
List<ImageStreamListener>.from(_listeners);
- for (ImageStreamListener listener in localListeners) {
+ for (final ImageStreamListener listener in localListeners) {
try {
listener.onImage(image, false);
} catch (exception, stack) {
@@ -469,7 +469,7 @@
if (localErrorListeners.isEmpty) {
FlutterError.reportError(_currentError);
} else {
- for (ImageErrorListener errorListener in localErrorListeners) {
+ for (final ImageErrorListener errorListener in localErrorListeners) {
try {
errorListener(exception, stack);
} catch (exception, stack) {
@@ -604,7 +604,7 @@
.map<ImageChunkListener>((ImageStreamListener listener) => listener.onChunk)
.where((ImageChunkListener chunkListener) => chunkListener != null)
.toList();
- for (ImageChunkListener listener in localListeners) {
+ for (final ImageChunkListener listener in localListeners) {
listener(event);
}
}
diff --git a/packages/flutter/lib/src/painting/shader_warm_up.dart b/packages/flutter/lib/src/painting/shader_warm_up.dart
index 608534f..420f334 100644
--- a/packages/flutter/lib/src/painting/shader_warm_up.dart
+++ b/packages/flutter/lib/src/painting/shader_warm_up.dart
@@ -171,7 +171,7 @@
// Warm up path stroke and fill shaders.
for (int i = 0; i < paths.length; i += 1) {
canvas.save();
- for (ui.Paint paint in paints) {
+ for (final ui.Paint paint in paints) {
canvas.drawPath(paths[i], paint);
canvas.translate(drawCallSpacing, 0.0);
}
@@ -202,7 +202,7 @@
//
// Add an integral or fractional translation to trigger Skia's non-AA or AA
// optimizations (as did before in normal FillRectOp in rrect clip cases).
- for (double fraction in <double>[0.0, 0.5]) {
+ for (final double fraction in <double>[0.0, 0.5]) {
canvas
..save()
..translate(fraction, fraction)
diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart
index 93d49d0..d4ea249 100644
--- a/packages/flutter/lib/src/painting/text_span.dart
+++ b/packages/flutter/lib/src/painting/text_span.dart
@@ -206,7 +206,7 @@
if (text != null)
builder.addText(text);
if (children != null) {
- for (InlineSpan child in children) {
+ for (final InlineSpan child in children) {
assert(child != null);
child.build(
builder,
@@ -231,7 +231,7 @@
return false;
}
if (children != null) {
- for (InlineSpan child in children) {
+ for (final InlineSpan child in children) {
if (!child.visitChildren(visitor))
return false;
}
@@ -256,7 +256,7 @@
return false;
}
if (children != null) {
- for (InlineSpan child in children) {
+ for (final InlineSpan child in children) {
assert(
child is TextSpan,
'visitTextSpan is deprecated. Use visitChildren to support InlineSpans',
@@ -300,7 +300,7 @@
buffer.write(text);
}
if (children != null) {
- for (InlineSpan child in children) {
+ for (final InlineSpan child in children) {
child.computeToPlainText(buffer,
includeSemanticsLabels: includeSemanticsLabels,
includePlaceholders: includePlaceholders,
@@ -320,7 +320,7 @@
));
}
if (children != null) {
- for (InlineSpan child in children) {
+ for (final InlineSpan child in children) {
child.computeSemanticsInformation(collector);
}
}
@@ -364,7 +364,7 @@
bool debugAssertIsValid() {
assert(() {
if (children != null) {
- for (InlineSpan child in children) {
+ for (final InlineSpan child in children) {
if (child == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('TextSpan contains a null child.'),
diff --git a/packages/flutter/lib/src/rendering/custom_paint.dart b/packages/flutter/lib/src/rendering/custom_paint.dart
index 59ed8cd..e3cc975 100644
--- a/packages/flutter/lib/src/rendering/custom_paint.dart
+++ b/packages/flutter/lib/src/rendering/custom_paint.dart
@@ -790,7 +790,7 @@
}
assert(() {
- for (SemanticsNode node in newChildren) {
+ for (final SemanticsNode node in newChildren) {
assert(node != null);
}
return true;
diff --git a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart
index 7911b0a..8ec25e1 100644
--- a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart
+++ b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart
@@ -282,7 +282,7 @@
}
final List<_OverflowRegionData> overflowRegions = _calculateOverflowRegions(overflow, containerRect);
- for (_OverflowRegionData region in overflowRegions) {
+ for (final _OverflowRegionData region in overflowRegions) {
context.canvas.drawRect(region.rect.shift(offset), _indicatorPaint);
final TextSpan textSpan = _indicatorLabel[region.side.index].text as TextSpan;
if (textSpan?.text != region.label) {
diff --git a/packages/flutter/lib/src/rendering/editable.dart b/packages/flutter/lib/src/rendering/editable.dart
index 79765ba..1b89c0e 100644
--- a/packages/flutter/lib/src/rendering/editable.dart
+++ b/packages/flutter/lib/src/rendering/editable.dart
@@ -1908,7 +1908,7 @@
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
assert(_selectionRects != null);
final Paint paint = Paint()..color = _selectionColor;
- for (ui.TextBox box in _selectionRects)
+ for (final ui.TextBox box in _selectionRects)
canvas.drawRect(box.toRect().shift(effectiveOffset), paint);
}
diff --git a/packages/flutter/lib/src/rendering/flow.dart b/packages/flutter/lib/src/rendering/flow.dart
index b2a7d45..533e5d8 100644
--- a/packages/flutter/lib/src/rendering/flow.dart
+++ b/packages/flutter/lib/src/rendering/flow.dart
@@ -352,7 +352,7 @@
_lastPaintOrder.clear();
_paintingContext = context;
_paintingOffset = offset;
- for (RenderBox child in _randomAccessChildren) {
+ for (final RenderBox child in _randomAccessChildren) {
final FlowParentData childParentData = child.parentData as FlowParentData;
childParentData._transform = null;
}
diff --git a/packages/flutter/lib/src/rendering/layer.dart b/packages/flutter/lib/src/rendering/layer.dart
index 4a32715..5b4f273 100644
--- a/packages/flutter/lib/src/rendering/layer.dart
+++ b/packages/flutter/lib/src/rendering/layer.dart
@@ -70,7 +70,7 @@
///
/// It is similar to [entries] but does not contain other information.
Iterable<T> get annotations sync* {
- for (AnnotationEntry<T> entry in _entries)
+ for (final AnnotationEntry<T> entry in _entries)
yield entry.annotation;
}
}
@@ -804,7 +804,7 @@
// PhysicalModelLayers. If we don't, we'll end up adding duplicate layers
// or continuing to render stale outlines.
if (temporaryLayers != null) {
- for (PictureLayer temporaryLayer in temporaryLayers) {
+ for (final PictureLayer temporaryLayer in temporaryLayers) {
temporaryLayer.remove();
}
}
diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart
index 1da7a3b..3476119 100644
--- a/packages/flutter/lib/src/rendering/object.dart
+++ b/packages/flutter/lib/src/rendering/object.dart
@@ -883,7 +883,7 @@
while (_nodesNeedingLayout.isNotEmpty) {
final List<RenderObject> dirtyNodes = _nodesNeedingLayout;
_nodesNeedingLayout = <RenderObject>[];
- for (RenderObject node in dirtyNodes..sort((RenderObject a, RenderObject b) => a.depth - b.depth)) {
+ for (final RenderObject node in dirtyNodes..sort((RenderObject a, RenderObject b) => a.depth - b.depth)) {
if (node._needsLayout && node.owner == this)
node._layoutWithoutResize();
}
@@ -935,7 +935,7 @@
Timeline.startSync('Compositing bits');
}
_nodesNeedingCompositingBitsUpdate.sort((RenderObject a, RenderObject b) => a.depth - b.depth);
- for (RenderObject node in _nodesNeedingCompositingBitsUpdate) {
+ for (final RenderObject node in _nodesNeedingCompositingBitsUpdate) {
if (node._needsCompositingBitsUpdate && node.owner == this)
node._updateCompositingBits();
}
@@ -974,7 +974,7 @@
final List<RenderObject> dirtyNodes = _nodesNeedingPaint;
_nodesNeedingPaint = <RenderObject>[];
// Sort the dirty nodes in reverse order (deepest first).
- for (RenderObject node in dirtyNodes..sort((RenderObject a, RenderObject b) => b.depth - a.depth)) {
+ for (final RenderObject node in dirtyNodes..sort((RenderObject a, RenderObject b) => b.depth - a.depth)) {
assert(node._layer != null);
if (node._needsPaint && node.owner == this) {
if (node._layer.attached) {
@@ -1079,7 +1079,7 @@
final List<RenderObject> nodesToProcess = _nodesNeedingSemantics.toList()
..sort((RenderObject a, RenderObject b) => a.depth - b.depth);
_nodesNeedingSemantics.clear();
- for (RenderObject node in nodesToProcess) {
+ for (final RenderObject node in nodesToProcess) {
if (node._needsSemanticsUpdate && node.owner == this)
node._updateSemantics();
}
@@ -2625,7 +2625,7 @@
dropSemanticsOfPreviousSiblings = true;
}
// Figure out which child fragments are to be made explicit.
- for (_InterestingSemanticsFragment fragment in parentFragment.interestingFragments) {
+ for (final _InterestingSemanticsFragment fragment in parentFragment.interestingFragments) {
fragments.add(fragment);
fragment.addAncestor(this);
fragment.addTags(config.tagsForChildren);
@@ -2637,7 +2637,7 @@
continue;
if (!config.isCompatibleWith(fragment.config))
toBeMarkedExplicit.add(fragment);
- for (_InterestingSemanticsFragment siblingFragment in fragments.sublist(0, fragments.length - 1)) {
+ for (final _InterestingSemanticsFragment siblingFragment in fragments.sublist(0, fragments.length - 1)) {
if (!fragment.config.isCompatibleWith(siblingFragment.config)) {
toBeMarkedExplicit.add(fragment);
toBeMarkedExplicit.add(siblingFragment);
@@ -2650,7 +2650,7 @@
return _AbortingSemanticsFragment(owner: this);
}
- for (_InterestingSemanticsFragment fragment in toBeMarkedExplicit)
+ for (final _InterestingSemanticsFragment fragment in toBeMarkedExplicit)
fragment.markAsExplicit();
_needsSemanticsUpdate = false;
@@ -3601,7 +3601,7 @@
Iterable<SemanticsNode> compileChildren({ Rect parentSemanticsClipRect, Rect parentPaintClipRect, double elevationAdjustment }) sync* {
if (!_isExplicit) {
owner._semantics = null;
- for (_InterestingSemanticsFragment fragment in _children) {
+ for (final _InterestingSemanticsFragment fragment in _children) {
assert(_ancestorChain.first == fragment._ancestorChain.last);
fragment._ancestorChain.addAll(_ancestorChain.sublist(1));
yield* fragment.compileChildren(
@@ -3671,7 +3671,7 @@
@override
void addAll(Iterable<_InterestingSemanticsFragment> fragments) {
- for (_InterestingSemanticsFragment fragment in fragments) {
+ for (final _InterestingSemanticsFragment fragment in fragments) {
_children.add(fragment);
if (fragment.config == null)
continue;
diff --git a/packages/flutter/lib/src/rendering/paragraph.dart b/packages/flutter/lib/src/rendering/paragraph.dart
index b62cdd0..5e9d800 100644
--- a/packages/flutter/lib/src/rendering/paragraph.dart
+++ b/packages/flutter/lib/src/rendering/paragraph.dart
@@ -333,7 +333,7 @@
// alignments that require the baseline (baseline, aboveBaseline,
// belowBaseline).
bool _canComputeIntrinsics() {
- for (PlaceholderSpan span in _placeholderSpans) {
+ for (final PlaceholderSpan span in _placeholderSpans) {
switch (span.alignment) {
case ui.PlaceholderAlignment.baseline:
case ui.PlaceholderAlignment.aboveBaseline:
@@ -781,7 +781,7 @@
final List<InlineSpanSemanticsInformation> combined = <InlineSpanSemanticsInformation>[];
String workingText = '';
String workingLabel;
- for (InlineSpanSemanticsInformation info in _semanticsInfo) {
+ for (final InlineSpanSemanticsInformation info in _semanticsInfo) {
if (info.requiresOwnNode) {
if (workingText != null) {
combined.add(InlineSpanSemanticsInformation(
@@ -823,7 +823,7 @@
config.isSemanticBoundary = true;
} else {
final StringBuffer buffer = StringBuffer();
- for (InlineSpanSemanticsInformation info in _semanticsInfo) {
+ for (final InlineSpanSemanticsInformation info in _semanticsInfo) {
buffer.write(info.semanticsLabel ?? info.text);
}
config.label = buffer.toString();
@@ -841,7 +841,7 @@
int start = 0;
int placeholderIndex = 0;
RenderBox child = firstChild;
- for (InlineSpanSemanticsInformation info in _combineSemanticsInfo()) {
+ for (final InlineSpanSemanticsInformation info in _combineSemanticsInfo()) {
final TextDirection initialDirection = currentDirection;
final TextSelection selection = TextSelection(
baseOffset: start,
@@ -853,7 +853,7 @@
}
Rect rect = rects.first.toRect();
currentDirection = rects.first.direction;
- for (ui.TextBox textBox in rects.skip(1)) {
+ for (final ui.TextBox textBox in rects.skip(1)) {
rect = rect.expandToInclude(textBox.toRect());
currentDirection = textBox.direction;
}
diff --git a/packages/flutter/lib/src/rendering/platform_view.dart b/packages/flutter/lib/src/rendering/platform_view.dart
index 90d62fc..76f6835 100644
--- a/packages/flutter/lib/src/rendering/platform_view.dart
+++ b/packages/flutter/lib/src/rendering/platform_view.dart
@@ -417,7 +417,7 @@
@override
void addAllowedPointer(PointerDownEvent event) {
startTrackingPointer(event.pointer, event.transform);
- for (OneSequenceGestureRecognizer recognizer in _gestureRecognizers) {
+ for (final OneSequenceGestureRecognizer recognizer in _gestureRecognizers) {
recognizer.addPointer(event);
}
}
@@ -493,7 +493,7 @@
@override
void addAllowedPointer(PointerDownEvent event) {
startTrackingPointer(event.pointer, event.transform);
- for (OneSequenceGestureRecognizer recognizer in _gestureRecognizers) {
+ for (final OneSequenceGestureRecognizer recognizer in _gestureRecognizers) {
recognizer.addPointer(event);
}
}
diff --git a/packages/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart b/packages/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart
index becf10e..037b342 100644
--- a/packages/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart
+++ b/packages/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart
@@ -375,14 +375,14 @@
@override
void attach(PipelineOwner owner) {
super.attach(owner);
- for (RenderBox child in _keepAliveBucket.values)
+ for (final RenderBox child in _keepAliveBucket.values)
child.attach(owner);
}
@override
void detach() {
super.detach();
- for (RenderBox child in _keepAliveBucket.values)
+ for (final RenderBox child in _keepAliveBucket.values)
child.detach();
}
@@ -683,7 +683,7 @@
}
if (_keepAliveBucket.isNotEmpty) {
final List<int> indices = _keepAliveBucket.keys.toList()..sort();
- for (int index in indices) {
+ for (final int index in indices) {
children.add(_keepAliveBucket[index].toDiagnosticsNode(
name: 'child with index $index (kept alive but not laid out)',
style: DiagnosticsTreeStyle.offstage,
diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart
index 12913ae..e0316f5 100644
--- a/packages/flutter/lib/src/rendering/table.dart
+++ b/packages/flutter/lib/src/rendering/table.dart
@@ -96,7 +96,7 @@
@override
double minIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) {
double result = 0.0;
- for (RenderBox cell in cells)
+ for (final RenderBox cell in cells)
result = math.max(result, cell.getMinIntrinsicWidth(double.infinity));
return result;
}
@@ -104,7 +104,7 @@
@override
double maxIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) {
double result = 0.0;
- for (RenderBox cell in cells)
+ for (final RenderBox cell in cells)
result = math.max(result, cell.getMaxIntrinsicWidth(double.infinity));
return result;
}
@@ -527,7 +527,7 @@
return;
_rowDecorations = value;
if (_rowDecorationPainters != null) {
- for (BoxPainter painter in _rowDecorationPainters)
+ for (final BoxPainter painter in _rowDecorationPainters)
painter?.dispose();
}
_rowDecorationPainters = _rowDecorations != null ? List<BoxPainter>(_rowDecorations.length) : null;
@@ -592,7 +592,7 @@
assert(_rows == 0);
return;
}
- for (RenderBox oldChild in _children) {
+ for (final RenderBox oldChild in _children) {
if (oldChild != null)
dropChild(oldChild);
}
@@ -645,7 +645,7 @@
setFlatChildren(0, null);
return;
}
- for (RenderBox oldChild in _children) {
+ for (final RenderBox oldChild in _children) {
if (oldChild != null)
dropChild(oldChild);
}
@@ -664,7 +664,7 @@
assert(_children.length == rows * columns);
_rows += 1;
_children.addAll(cells);
- for (RenderBox cell in cells) {
+ for (final RenderBox cell in cells) {
if (cell != null)
adoptChild(cell);
}
@@ -695,7 +695,7 @@
@override
void attach(PipelineOwner owner) {
super.attach(owner);
- for (RenderBox child in _children)
+ for (final RenderBox child in _children)
child?.attach(owner);
}
@@ -703,18 +703,18 @@
void detach() {
super.detach();
if (_rowDecorationPainters != null) {
- for (BoxPainter painter in _rowDecorationPainters)
+ for (final BoxPainter painter in _rowDecorationPainters)
painter?.dispose();
_rowDecorationPainters = List<BoxPainter>(_rowDecorations.length);
}
- for (RenderBox child in _children)
+ for (final RenderBox child in _children)
child?.detach();
}
@override
void visitChildren(RenderObjectVisitor visitor) {
assert(_children.length == rows * columns);
- for (RenderBox child in _children) {
+ for (final RenderBox child in _children) {
if (child != null)
visitor(child);
}
diff --git a/packages/flutter/lib/src/rendering/table_border.dart b/packages/flutter/lib/src/rendering/table_border.dart
index a277440..7fa0118 100644
--- a/packages/flutter/lib/src/rendering/table_border.dart
+++ b/packages/flutter/lib/src/rendering/table_border.dart
@@ -226,7 +226,7 @@
..strokeWidth = verticalInside.width
..style = PaintingStyle.stroke;
path.reset();
- for (double x in columns) {
+ for (final double x in columns) {
path.moveTo(rect.left + x, rect.top);
path.lineTo(rect.left + x, rect.bottom);
}
@@ -245,7 +245,7 @@
..strokeWidth = horizontalInside.width
..style = PaintingStyle.stroke;
path.reset();
- for (double y in rows) {
+ for (final double y in rows) {
path.moveTo(rect.left, rect.top + y);
path.lineTo(rect.right, rect.top + y);
}
diff --git a/packages/flutter/lib/src/rendering/viewport.dart b/packages/flutter/lib/src/rendering/viewport.dart
index 7ce0996..809b321 100644
--- a/packages/flutter/lib/src/rendering/viewport.dart
+++ b/packages/flutter/lib/src/rendering/viewport.dart
@@ -581,7 +581,7 @@
}
void _paintContents(PaintingContext context, Offset offset) {
- for (RenderSliver child in childrenInPaintOrder) {
+ for (final RenderSliver child in childrenInPaintOrder) {
if (child.geometry.visible)
context.paintChild(child, offset + paintOffsetOf(child));
}
@@ -631,7 +631,7 @@
assert(mainAxisPosition != null);
assert(crossAxisPosition != null);
final SliverHitTestResult sliverResult = SliverHitTestResult.wrap(result);
- for (RenderSliver child in childrenInHitTestOrder) {
+ for (final RenderSliver child in childrenInHitTestOrder) {
if (!child.geometry.visible) {
continue;
}
diff --git a/packages/flutter/lib/src/scheduler/binding.dart b/packages/flutter/lib/src/scheduler/binding.dart
index 17983c5..05ad7c5 100644
--- a/packages/flutter/lib/src/scheduler/binding.dart
+++ b/packages/flutter/lib/src/scheduler/binding.dart
@@ -209,7 +209,7 @@
if (!kReleaseMode) {
int frameNumber = 0;
addTimingsCallback((List<FrameTiming> timings) {
- for (FrameTiming frameTiming in timings) {
+ for (final FrameTiming frameTiming in timings) {
frameNumber += 1;
_profileFramePostEvent(frameNumber, frameTiming);
}
@@ -249,7 +249,7 @@
void _executeTimingsCallbacks(List<FrameTiming> timings) {
final List<TimingsCallback> clonedCallbacks =
List<TimingsCallback>.from(_timingsCallbacks);
- for (TimingsCallback callback in clonedCallbacks) {
+ for (final TimingsCallback callback in clonedCallbacks) {
try {
if (_timingsCallbacks.contains(callback)) {
callback(timings);
@@ -582,7 +582,7 @@
'The stack traces for when they were registered are as follows:'
);
}
- for (int id in callbacks.keys) {
+ for (final int id in callbacks.keys) {
final _FrameCallbackEntry entry = callbacks[id];
yield DiagnosticsStackTrace('── callback $id ──', entry.debugStack, showSeparator: false);
}
@@ -1043,7 +1043,7 @@
try {
// PERSISTENT FRAME CALLBACKS
_schedulerPhase = SchedulerPhase.persistentCallbacks;
- for (FrameCallback callback in _persistentCallbacks)
+ for (final FrameCallback callback in _persistentCallbacks)
_invokeFrameCallback(callback, _currentFrameTimeStamp);
// POST-FRAME CALLBACKS
@@ -1051,7 +1051,7 @@
final List<FrameCallback> localPostFrameCallbacks =
List<FrameCallback>.from(_postFrameCallbacks);
_postFrameCallbacks.clear();
- for (FrameCallback callback in localPostFrameCallbacks)
+ for (final FrameCallback callback in localPostFrameCallbacks)
_invokeFrameCallback(callback, _currentFrameTimeStamp);
} finally {
_schedulerPhase = SchedulerPhase.idle;
diff --git a/packages/flutter/lib/src/semantics/semantics.dart b/packages/flutter/lib/src/semantics/semantics.dart
index 3d17560..5831864 100644
--- a/packages/flutter/lib/src/semantics/semantics.dart
+++ b/packages/flutter/lib/src/semantics/semantics.dart
@@ -386,7 +386,7 @@
properties.add(DoubleProperty('elevation', elevation, defaultValue: 0.0));
properties.add(DoubleProperty('thickness', thickness, defaultValue: 0.0));
final List<String> actionSummary = <String>[
- for (SemanticsAction action in SemanticsAction.values.values)
+ for (final SemanticsAction action in SemanticsAction.values.values)
if ((actions & action.index) != 0)
describeEnum(action),
];
@@ -397,7 +397,7 @@
properties.add(IterableProperty<String>('customActions', customSemanticsActionSummary, ifEmpty: null));
final List<String> flagSummary = <String>[
- for (SemanticsFlag flag in SemanticsFlag.values.values)
+ for (final SemanticsFlag flag in SemanticsFlag.values.values)
if ((flags & flag.index) != 0)
describeEnum(flag),
];
@@ -1397,25 +1397,25 @@
}());
assert(() {
final Set<SemanticsNode> seenChildren = <SemanticsNode>{};
- for (SemanticsNode child in newChildren)
+ for (final SemanticsNode child in newChildren)
assert(seenChildren.add(child)); // check for duplicate adds
return true;
}());
// The goal of this function is updating sawChange.
if (_children != null) {
- for (SemanticsNode child in _children)
+ for (final SemanticsNode child in _children)
child._dead = true;
}
if (newChildren != null) {
- for (SemanticsNode child in newChildren) {
+ for (final SemanticsNode child in newChildren) {
assert(!child.isInvisible, 'Child $child is invisible and should not be added as a child of $this.');
child._dead = false;
}
}
bool sawChange = false;
if (_children != null) {
- for (SemanticsNode child in _children) {
+ for (final SemanticsNode child in _children) {
if (child._dead) {
if (child.parent == this) {
// we might have already had our child stolen from us by
@@ -1427,7 +1427,7 @@
}
}
if (newChildren != null) {
- for (SemanticsNode child in newChildren) {
+ for (final SemanticsNode child in newChildren) {
if (child.parent != this) {
if (child.parent != null) {
// we're rebuilding the tree from the bottom up, so it's possible
@@ -1473,7 +1473,7 @@
/// returns false.
void visitChildren(SemanticsNodeVisitor visitor) {
if (_children != null) {
- for (SemanticsNode child in _children) {
+ for (final SemanticsNode child in _children) {
if (!visitor(child))
return;
}
@@ -1487,7 +1487,7 @@
/// returned true, otherwise returns false.
bool _visitDescendants(SemanticsNodeVisitor visitor) {
if (_children != null) {
- for (SemanticsNode child in _children) {
+ for (final SemanticsNode child in _children) {
if (!visitor(child) || !child._visitDescendants(visitor))
return false;
}
@@ -1519,7 +1519,7 @@
_markDirty();
}
if (_children != null) {
- for (SemanticsNode child in _children)
+ for (final SemanticsNode child in _children)
child.attach(owner);
}
}
@@ -1533,7 +1533,7 @@
super.detach();
assert(owner == null);
if (_children != null) {
- for (SemanticsNode child in _children) {
+ for (final SemanticsNode child in _children) {
// The list of children may be stale and may contain nodes that have
// been assigned to a different parent.
if (child.parent == this)
@@ -1910,7 +1910,7 @@
final double elevation = _elevation;
double thickness = _thickness;
final Set<int> customSemanticsActionIds = <int>{};
- for (CustomSemanticsAction action in _customSemanticsActions.keys)
+ for (final CustomSemanticsAction action in _customSemanticsActions.keys)
customSemanticsActionIds.add(CustomSemanticsAction.getIdentifier(action));
if (hintOverrides != null) {
if (hintOverrides.onTapHint != null) {
@@ -1955,7 +1955,7 @@
mergedTags.addAll(node.tags);
}
if (node._customSemanticsActions != null) {
- for (CustomSemanticsAction action in _customSemanticsActions.keys)
+ for (final CustomSemanticsAction action in _customSemanticsActions.keys)
customSemanticsActionIds.add(CustomSemanticsAction.getIdentifier(action));
}
if (node.hintOverrides != null) {
@@ -2356,7 +2356,7 @@
/// then sorts them using [sortedWithinKnot].
List<SemanticsNode> sortedWithinVerticalGroup() {
final List<_BoxEdge> edges = <_BoxEdge>[];
- for (SemanticsNode child in nodes) {
+ for (final SemanticsNode child in nodes) {
// Using a small delta to shrink child rects removes overlapping cases.
final Rect childRect = child.rect.deflate(0.1);
edges.add(_BoxEdge(
@@ -2375,7 +2375,7 @@
List<_SemanticsSortGroup> horizontalGroups = <_SemanticsSortGroup>[];
_SemanticsSortGroup group;
int depth = 0;
- for (_BoxEdge edge in edges) {
+ for (final _BoxEdge edge in edges) {
if (edge.isLeadingEdge) {
depth += 1;
group ??= _SemanticsSortGroup(
@@ -2424,10 +2424,10 @@
}
final Map<int, SemanticsNode> nodeMap = <int, SemanticsNode>{};
final Map<int, int> edges = <int, int>{};
- for (SemanticsNode node in nodes) {
+ for (final SemanticsNode node in nodes) {
nodeMap[node.id] = node;
final Offset center = _pointInParentCoordinates(node, node.rect.center);
- for (SemanticsNode nextNode in nodes) {
+ for (final SemanticsNode nextNode in nodes) {
if (identical(node, nextNode) || edges[nextNode.id] == node.id) {
// Skip self or when we've already established that the next node
// points to current node.
@@ -2499,7 +2499,7 @@
/// For an illustration of the algorithm see http://bit.ly/flutter-default-traversal.
List<SemanticsNode> _childrenInDefaultOrder(List<SemanticsNode> children, TextDirection textDirection) {
final List<_BoxEdge> edges = <_BoxEdge>[];
- for (SemanticsNode child in children) {
+ for (final SemanticsNode child in children) {
assert(child.rect.isFinite);
// Using a small delta to shrink child rects removes overlapping cases.
final Rect childRect = child.rect.deflate(0.1);
@@ -2519,7 +2519,7 @@
final List<_SemanticsSortGroup> verticalGroups = <_SemanticsSortGroup>[];
_SemanticsSortGroup group;
int depth = 0;
- for (_BoxEdge edge in edges) {
+ for (final _BoxEdge edge in edges) {
if (edge.isLeadingEdge) {
depth += 1;
group ??= _SemanticsSortGroup(
@@ -2616,7 +2616,7 @@
_detachedNodes.clear();
localDirtyNodes.sort((SemanticsNode a, SemanticsNode b) => a.depth - b.depth);
visitedNodes.addAll(localDirtyNodes);
- for (SemanticsNode node in localDirtyNodes) {
+ for (final SemanticsNode node in localDirtyNodes) {
assert(node._dirty);
assert(node.parent == null || !node.parent.isPartOfNodeMerging || node.isMergedIntoParent);
if (node.isPartOfNodeMerging) {
@@ -2629,7 +2629,7 @@
}
visitedNodes.sort((SemanticsNode a, SemanticsNode b) => a.depth - b.depth);
final ui.SemanticsUpdateBuilder builder = ui.SemanticsUpdateBuilder();
- for (SemanticsNode node in visitedNodes) {
+ for (final SemanticsNode node in visitedNodes) {
assert(node.parent?._dirty != true); // could be null (no parent) or false (not dirty)
// The _serialize() method marks the node as not dirty, and
// recurses through the tree to do a deep serialization of all
@@ -2645,7 +2645,7 @@
node._addToUpdate(builder, customSemanticsActionIds);
}
_dirtyNodes.clear();
- for (int actionId in customSemanticsActionIds) {
+ for (final int actionId in customSemanticsActionIds) {
final CustomSemanticsAction action = CustomSemanticsAction.getAction(actionId);
builder.updateCustomAction(id: actionId, label: action.label, hint: action.hint, overrideId: action.action?.index ?? -1);
}
@@ -2710,7 +2710,7 @@
return result?._actions[action];
}
if (node.hasChildren) {
- for (SemanticsNode child in node._children.reversed) {
+ for (final SemanticsNode child in node._children.reversed) {
final _SemanticsActionHandler handler = _getSemanticsActionHandlerForPosition(child, position, action);
if (handler != null)
return handler;
diff --git a/packages/flutter/lib/src/semantics/semantics_event.dart b/packages/flutter/lib/src/semantics/semantics_event.dart
index 657c4d4..71b96b7 100644
--- a/packages/flutter/lib/src/semantics/semantics_event.dart
+++ b/packages/flutter/lib/src/semantics/semantics_event.dart
@@ -46,7 +46,7 @@
final List<String> pairs = <String>[];
final Map<String, dynamic> dataMap = getDataMap();
final List<String> sortedKeys = dataMap.keys.toList()..sort();
- for (String key in sortedKeys)
+ for (final String key in sortedKeys)
pairs.add('$key: ${dataMap[key]}');
return '$runtimeType(${pairs.join(', ')})';
}
diff --git a/packages/flutter/lib/src/services/binding.dart b/packages/flutter/lib/src/services/binding.dart
index cd1b7e6..88a320e 100644
--- a/packages/flutter/lib/src/services/binding.dart
+++ b/packages/flutter/lib/src/services/binding.dart
@@ -101,7 +101,7 @@
final String _licenseSeparator = '\n' + ('-' * 80) + '\n';
final List<LicenseEntry> result = <LicenseEntry>[];
final List<String> licenses = rawLicenses.split(_licenseSeparator);
- for (String license in licenses) {
+ for (final String license in licenses) {
final int split = license.indexOf('\n\n');
if (split >= 0) {
result.add(LicenseEntryWithLineBreaks(
diff --git a/packages/flutter/lib/src/services/keyboard_key.dart b/packages/flutter/lib/src/services/keyboard_key.dart
index c9eb338..3c8e0b3 100644
--- a/packages/flutter/lib/src/services/keyboard_key.dart
+++ b/packages/flutter/lib/src/services/keyboard_key.dart
@@ -246,7 +246,7 @@
/// [control], so that the question "is any control key down?" can be asked.
static Set<LogicalKeyboardKey> collapseSynonyms(Set<LogicalKeyboardKey> input) {
final Set<LogicalKeyboardKey> result = <LogicalKeyboardKey>{};
- for (LogicalKeyboardKey key in input) {
+ for (final LogicalKeyboardKey key in input) {
final LogicalKeyboardKey synonym = _synonyms[key];
result.add(synonym ?? key);
}
diff --git a/packages/flutter/lib/src/services/platform_channel.dart b/packages/flutter/lib/src/services/platform_channel.dart
index 978e16e..3a32f36 100644
--- a/packages/flutter/lib/src/services/platform_channel.dart
+++ b/packages/flutter/lib/src/services/platform_channel.dart
@@ -289,7 +289,7 @@
/// } else if ([@"getSongs" isEqualToString:call.method]) {
/// NSArray* items = [BWPlayApi items];
/// NSMutableArray* json = [NSMutableArray arrayWithCapacity:items.count];
- /// for (BWPlayItem* item in items) {
+ /// for (final BWPlayItem* item in items) {
/// [json addObject:@{@"id":item.itemId, @"title":item.name, @"artist":item.artist}];
/// }
/// result(json);
diff --git a/packages/flutter/lib/src/services/platform_views.dart b/packages/flutter/lib/src/services/platform_views.dart
index 70022fc..646d4e6 100644
--- a/packages/flutter/lib/src/services/platform_views.dart
+++ b/packages/flutter/lib/src/services/platform_views.dart
@@ -633,7 +633,7 @@
}
_textureId = await SystemChannels.platform_views.invokeMethod('create', args);
_state = _AndroidViewState.created;
- for (PlatformViewCreatedCallback callback in _platformViewCreatedCallbacks) {
+ for (final PlatformViewCreatedCallback callback in _platformViewCreatedCallbacks) {
callback(id);
}
}
diff --git a/packages/flutter/lib/src/services/raw_keyboard.dart b/packages/flutter/lib/src/services/raw_keyboard.dart
index 6d3969d..3a841c0 100644
--- a/packages/flutter/lib/src/services/raw_keyboard.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard.dart
@@ -165,7 +165,7 @@
/// event, and the keyboard side or sides that the key was on.
Map<ModifierKey, KeyboardSide> get modifiersPressed {
final Map<ModifierKey, KeyboardSide> result = <ModifierKey, KeyboardSide>{};
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (isModifierPressed(key)) {
result[key] = getModifierSide(key);
}
@@ -523,7 +523,7 @@
if (_listeners.isEmpty) {
return;
}
- for (ValueChanged<RawKeyEvent> listener in List<ValueChanged<RawKeyEvent>>.from(_listeners)) {
+ for (final ValueChanged<RawKeyEvent> listener in List<ValueChanged<RawKeyEvent>>.from(_listeners)) {
if (_listeners.contains(listener)) {
listener(event);
}
@@ -575,7 +575,7 @@
void _synchronizeModifiers(RawKeyEvent event) {
final Map<ModifierKey, KeyboardSide> modifiersPressed = event.data.modifiersPressed;
final Set<LogicalKeyboardKey> modifierKeys = <LogicalKeyboardKey>{};
- for (ModifierKey key in modifiersPressed.keys) {
+ for (final ModifierKey key in modifiersPressed.keys) {
final Set<LogicalKeyboardKey> mappedKeys = _modifierKeyMap[_ModifierSidePair(key, modifiersPressed[key])];
assert(mappedKeys != null,
'Platform key support for ${Platform.operatingSystem} is '
diff --git a/packages/flutter/lib/src/services/system_chrome.dart b/packages/flutter/lib/src/services/system_chrome.dart
index b20413a..ebd7bfe 100644
--- a/packages/flutter/lib/src/services/system_chrome.dart
+++ b/packages/flutter/lib/src/services/system_chrome.dart
@@ -207,7 +207,7 @@
}
List<String> _stringify(List<dynamic> list) => <String>[
- for (dynamic item in list) item.toString(),
+ for (final dynamic item in list) item.toString(),
];
/// Controls specific aspects of the operating system's graphical interface and
diff --git a/packages/flutter/lib/src/widgets/animated_list.dart b/packages/flutter/lib/src/widgets/animated_list.dart
index a9477be..6298411 100644
--- a/packages/flutter/lib/src/widgets/animated_list.dart
+++ b/packages/flutter/lib/src/widgets/animated_list.dart
@@ -828,7 +828,7 @@
@override
void dispose() {
- for (_ActiveItem item in _incomingItems.followedBy(_outgoingItems)) {
+ for (final _ActiveItem item in _incomingItems.followedBy(_outgoingItems)) {
item.controller.dispose();
}
super.dispose();
@@ -852,7 +852,7 @@
int _indexToItemIndex(int index) {
int itemIndex = index;
- for (_ActiveItem item in _outgoingItems) {
+ for (final _ActiveItem item in _outgoingItems) {
if (item.itemIndex <= itemIndex)
itemIndex += 1;
else
@@ -863,7 +863,7 @@
int _itemIndexToIndex(int itemIndex) {
int index = itemIndex;
- for (_ActiveItem item in _outgoingItems) {
+ for (final _ActiveItem item in _outgoingItems) {
assert(item.itemIndex != itemIndex);
if (item.itemIndex < itemIndex)
index -= 1;
@@ -892,11 +892,11 @@
// Increment the incoming and outgoing item indices to account
// for the insertion.
- for (_ActiveItem item in _incomingItems) {
+ for (final _ActiveItem item in _incomingItems) {
if (item.itemIndex >= itemIndex)
item.itemIndex += 1;
}
- for (_ActiveItem item in _outgoingItems) {
+ for (final _ActiveItem item in _outgoingItems) {
if (item.itemIndex >= itemIndex)
item.itemIndex += 1;
}
@@ -956,11 +956,11 @@
// Decrement the incoming and outgoing item indices to account
// for the removal.
- for (_ActiveItem item in _incomingItems) {
+ for (final _ActiveItem item in _incomingItems) {
if (item.itemIndex > outgoingItem.itemIndex)
item.itemIndex -= 1;
}
- for (_ActiveItem item in _outgoingItems) {
+ for (final _ActiveItem item in _outgoingItems) {
if (item.itemIndex > outgoingItem.itemIndex)
item.itemIndex -= 1;
}
diff --git a/packages/flutter/lib/src/widgets/animated_switcher.dart b/packages/flutter/lib/src/widgets/animated_switcher.dart
index 4c29e4a..10d1c50 100644
--- a/packages/flutter/lib/src/widgets/animated_switcher.dart
+++ b/packages/flutter/lib/src/widgets/animated_switcher.dart
@@ -425,7 +425,7 @@
void dispose() {
if (_currentEntry != null)
_currentEntry.controller.dispose();
- for (_ChildEntry entry in _outgoingEntries)
+ for (final _ChildEntry entry in _outgoingEntries)
entry.controller.dispose();
super.dispose();
}
diff --git a/packages/flutter/lib/src/widgets/app.dart b/packages/flutter/lib/src/widgets/app.dart
index bd3ce0f..7c29768 100644
--- a/packages/flutter/lib/src/widgets/app.dart
+++ b/packages/flutter/lib/src/widgets/app.dart
@@ -1110,7 +1110,7 @@
final Map<String, Locale> languageAndScriptLocales = HashMap<String, Locale>();
final Map<String, Locale> languageLocales = HashMap<String, Locale>();
final Map<String, Locale> countryLocales = HashMap<String, Locale>();
- for (Locale locale in supportedLocales) {
+ for (final Locale locale in supportedLocales) {
allSupportedLocales['${locale.languageCode}_${locale.scriptCode}_${locale.countryCode}'] ??= locale;
languageAndScriptLocales['${locale.languageCode}_${locale.scriptCode}'] ??= locale;
languageAndCountryLocales['${locale.languageCode}_${locale.countryCode}'] ??= locale;
@@ -1209,7 +1209,7 @@
assert(() {
final Set<Type> unsupportedTypes =
_localizationsDelegates.map<Type>((LocalizationsDelegate<dynamic> delegate) => delegate.type).toSet();
- for (LocalizationsDelegate<dynamic> delegate in _localizationsDelegates) {
+ for (final LocalizationsDelegate<dynamic> delegate in _localizationsDelegates) {
if (!unsupportedTypes.contains(delegate.type))
continue;
if (delegate.isSupported(appLocale))
@@ -1230,7 +1230,7 @@
'Warning: This application\'s locale, $appLocale, is not supported by all of its\n'
'localization delegates.'
);
- for (Type unsupportedType in unsupportedTypes) {
+ for (final Type unsupportedType in unsupportedTypes) {
// Currently the Cupertino library only provides english localizations.
// Remove this when https://github.com/flutter/flutter/issues/23847
// is fixed.
diff --git a/packages/flutter/lib/src/widgets/automatic_keep_alive.dart b/packages/flutter/lib/src/widgets/automatic_keep_alive.dart
index aafc441..5d61d0b 100644
--- a/packages/flutter/lib/src/widgets/automatic_keep_alive.dart
+++ b/packages/flutter/lib/src/widgets/automatic_keep_alive.dart
@@ -66,7 +66,7 @@
@override
void dispose() {
if (_handles != null) {
- for (Listenable handle in _handles.keys)
+ for (final Listenable handle in _handles.keys)
handle.removeListener(_handles[handle]);
}
super.dispose();
diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart
index a1143b9..eb236eb 100644
--- a/packages/flutter/lib/src/widgets/basic.dart
+++ b/packages/flutter/lib/src/widgets/basic.dart
@@ -6784,7 +6784,7 @@
final List<Widget> itemsWithUniqueKeys = <Widget>[];
int itemIndex = baseIndex;
- for (Widget item in items) {
+ for (final Widget item in items) {
itemsWithUniqueKeys.add(KeyedSubtree.wrap(item, itemIndex));
itemIndex += 1;
}
diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart
index 1fba2f5..995cb3e 100644
--- a/packages/flutter/lib/src/widgets/binding.dart
+++ b/packages/flutter/lib/src/widgets/binding.dart
@@ -447,28 +447,28 @@
@override
void handleMetricsChanged() {
super.handleMetricsChanged();
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didChangeMetrics();
}
@override
void handleTextScaleFactorChanged() {
super.handleTextScaleFactorChanged();
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didChangeTextScaleFactor();
}
@override
void handlePlatformBrightnessChanged() {
super.handlePlatformBrightnessChanged();
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didChangePlatformBrightness();
}
@override
void handleAccessibilityFeaturesChanged() {
super.handleAccessibilityFeaturesChanged();
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didChangeAccessibilityFeatures();
}
@@ -492,7 +492,7 @@
@protected
@mustCallSuper
void dispatchLocalesChanged(List<Locale> locales) {
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didChangeLocales(locales);
}
@@ -505,7 +505,7 @@
@protected
@mustCallSuper
void dispatchAccessibilityFeaturesChanged() {
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didChangeAccessibilityFeatures();
}
@@ -525,7 +525,7 @@
/// [SystemChannels.navigation].
@protected
Future<void> handlePopRoute() async {
- for (WidgetsBindingObserver observer in List<WidgetsBindingObserver>.from(_observers)) {
+ for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.from(_observers)) {
if (await observer.didPopRoute())
return;
}
@@ -545,7 +545,7 @@
@protected
@mustCallSuper
Future<void> handlePushRoute(String route) async {
- for (WidgetsBindingObserver observer in List<WidgetsBindingObserver>.from(_observers)) {
+ for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.from(_observers)) {
if (await observer.didPushRoute(route))
return;
}
@@ -564,7 +564,7 @@
@override
void handleAppLifecycleStateChanged(AppLifecycleState state) {
super.handleAppLifecycleStateChanged(state);
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didChangeAppLifecycleState(state);
}
@@ -577,7 +577,7 @@
/// This method exposes the `memoryPressure` notification from
/// [SystemChannels.system].
void handleMemoryPressure() {
- for (WidgetsBindingObserver observer in _observers)
+ for (final WidgetsBindingObserver observer in _observers)
observer.didHaveMemoryPressure();
}
diff --git a/packages/flutter/lib/src/widgets/debug.dart b/packages/flutter/lib/src/widgets/debug.dart
index 2c334c0..79a8746 100644
--- a/packages/flutter/lib/src/widgets/debug.dart
+++ b/packages/flutter/lib/src/widgets/debug.dart
@@ -108,7 +108,7 @@
Key _firstNonUniqueKey(Iterable<Widget> widgets) {
final Set<Key> keySet = HashSet<Key>();
- for (Widget widget in widgets) {
+ for (final Widget widget in widgets) {
assert(widget != null);
if (widget.key == null)
continue;
diff --git a/packages/flutter/lib/src/widgets/drag_target.dart b/packages/flutter/lib/src/widgets/drag_target.dart
index 1365be2..78d1261 100644
--- a/packages/flutter/lib/src/widgets/drag_target.dart
+++ b/packages/flutter/lib/src/widgets/drag_target.dart
@@ -669,7 +669,7 @@
Iterable<_DragTargetState<T>> _getDragTargets(Iterable<HitTestEntry> path) sync* {
// Look for the RenderBoxes that corresponds to the hit target (the hit target
// widgets build RenderMetaData boxes for us for this purpose).
- for (HitTestEntry entry in path) {
+ for (final HitTestEntry entry in path) {
final HitTestTarget target = entry.target;
if (target is RenderMetaData) {
final dynamic metaData = target.metaData;
diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart
index 54e2f14..8188fb6 100644
--- a/packages/flutter/lib/src/widgets/editable_text.dart
+++ b/packages/flutter/lib/src/widgets/editable_text.dart
@@ -1618,7 +1618,7 @@
void _formatAndSetValue(TextEditingValue value) {
final bool textChanged = _value?.text != value?.text;
if (textChanged && widget.inputFormatters != null && widget.inputFormatters.isNotEmpty) {
- for (TextInputFormatter formatter in widget.inputFormatters)
+ for (final TextInputFormatter formatter in widget.inputFormatters)
value = formatter.formatEditUpdate(_value, value);
_value = value;
_updateRemoteEditingValueIfNeeded();
diff --git a/packages/flutter/lib/src/widgets/focus_manager.dart b/packages/flutter/lib/src/widgets/focus_manager.dart
index e5d9a00..2942c7c 100644
--- a/packages/flutter/lib/src/widgets/focus_manager.dart
+++ b/packages/flutter/lib/src/widgets/focus_manager.dart
@@ -24,7 +24,7 @@
if (_kDebugFocus) {
debugPrint('FOCUS: $message');
if (details != null && details.isNotEmpty) {
- for (String detail in details) {
+ for (final String detail in details) {
debugPrint(' $detail');
}
}
@@ -507,7 +507,7 @@
Iterable<FocusNode> get descendants {
if (_descendants == null) {
final List<FocusNode> result = <FocusNode>[];
- for (FocusNode child in _children) {
+ for (final FocusNode child in _children) {
result.addAll(child.descendants);
result.add(child);
}
@@ -732,7 +732,7 @@
node._parent = null;
_children.remove(node);
- for (FocusNode ancestor in ancestors) {
+ for (final FocusNode ancestor in ancestors) {
ancestor._descendants = null;
}
_descendants = null;
@@ -741,7 +741,7 @@
void _updateManager(FocusManager manager) {
_manager = manager;
- for (FocusNode descendant in descendants) {
+ for (final FocusNode descendant in descendants) {
descendant._manager = manager;
descendant._ancestors = null;
}
@@ -766,7 +766,7 @@
child._parent = this;
child._ancestors = null;
child._updateManager(_manager);
- for (FocusNode ancestor in child.ancestors) {
+ for (final FocusNode ancestor in child.ancestors) {
ancestor._descendants = null;
}
if (hadFocus) {
@@ -869,7 +869,7 @@
/// child in that scope is removed, the previous focus returns.
void _setAsFocusedChild() {
FocusNode scopeFocus = this;
- for (FocusScopeNode ancestor in ancestors.whereType<FocusScopeNode>()) {
+ for (final FocusScopeNode ancestor in ancestors.whereType<FocusScopeNode>()) {
assert(scopeFocus != ancestor, 'Somehow made a loop by setting focusedChild to its scope.');
assert(_focusDebug('Setting $scopeFocus as focused child for scope:', <String>[ancestor.toString()]));
// Remove it anywhere in the focused child history.
@@ -1258,7 +1258,7 @@
return;
}
final List<ValueChanged<FocusHighlightMode>> localListeners = List<ValueChanged<FocusHighlightMode>>.from(_listeners);
- for (ValueChanged<FocusHighlightMode> listener in localListeners) {
+ for (final ValueChanged<FocusHighlightMode> listener in localListeners) {
try {
if (_listeners.contains(listener)) {
listener(_highlightMode);
@@ -1322,7 +1322,7 @@
return;
}
bool handled = false;
- for (FocusNode node in <FocusNode>[_primaryFocus, ..._primaryFocus.ancestors]) {
+ for (final FocusNode node in <FocusNode>[_primaryFocus, ..._primaryFocus.ancestors]) {
if (node.onKey != null && node.onKey(node, event)) {
assert(_focusDebug('Node $node handled key event $event.'));
handled = true;
@@ -1409,7 +1409,7 @@
}
}
assert(_focusDebug('Notifying ${_dirtyNodes.length} dirty nodes:', _dirtyNodes.toList().map<String>((FocusNode node) => node.toString())));
- for (FocusNode node in _dirtyNodes) {
+ for (final FocusNode node in _dirtyNodes) {
node._notify();
}
_dirtyNodes.clear();
diff --git a/packages/flutter/lib/src/widgets/focus_traversal.dart b/packages/flutter/lib/src/widgets/focus_traversal.dart
index 09be0f5..c88ed39 100644
--- a/packages/flutter/lib/src/widgets/focus_traversal.dart
+++ b/packages/flutter/lib/src/widgets/focus_traversal.dart
@@ -618,7 +618,7 @@
FocusNode firstNode;
FocusNode lastNode;
bool visit(FocusNode node) {
- for (FocusNode visited in node.traversalChildren) {
+ for (final FocusNode visited in node.traversalChildren) {
firstNode ??= visited;
if (!visit(visited)) {
return false;
@@ -750,7 +750,7 @@
}
final List<_SortData> data = <_SortData>[
- for (FocusNode node in nodes) _SortData(node),
+ for (final FocusNode node in nodes) _SortData(node),
];
// Pick the initial widget as the one that is leftmost in the band of the
@@ -800,7 +800,7 @@
final Iterable<FocusNode> maybeFlipped = forward ? sortedNodes : sortedNodes.reversed;
FocusNode previousNode;
- for (FocusNode node in maybeFlipped) {
+ for (final FocusNode node in maybeFlipped) {
if (previousNode == focusedChild) {
_focusAndEnsureVisible(
node,
diff --git a/packages/flutter/lib/src/widgets/form.dart b/packages/flutter/lib/src/widgets/form.dart
index 1d8d94c..9b71f4b 100644
--- a/packages/flutter/lib/src/widgets/form.dart
+++ b/packages/flutter/lib/src/widgets/form.dart
@@ -177,7 +177,7 @@
/// Saves every [FormField] that is a descendant of this [Form].
void save() {
- for (FormFieldState<dynamic> field in _fields)
+ for (final FormFieldState<dynamic> field in _fields)
field.save();
}
@@ -189,7 +189,7 @@
/// If the form's [Form.autovalidate] property is true, the fields will all be
/// revalidated after being reset.
void reset() {
- for (FormFieldState<dynamic> field in _fields)
+ for (final FormFieldState<dynamic> field in _fields)
field.reset();
_fieldDidChange();
}
@@ -205,7 +205,7 @@
bool _validate() {
bool hasError = false;
- for (FormFieldState<dynamic> field in _fields)
+ for (final FormFieldState<dynamic> field in _fields)
hasError = !field.validate() || hasError;
return !hasError;
}
diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart
index 47f3d56..000a1ce 100644
--- a/packages/flutter/lib/src/widgets/framework.dart
+++ b/packages/flutter/lib/src/widgets/framework.dart
@@ -206,7 +206,7 @@
static void _debugVerifyIllFatedPopulation() {
assert(() {
Map<GlobalKey, Set<Element>> duplicates;
- for (Element element in _debugIllFatedElements) {
+ for (final Element element in _debugIllFatedElements) {
if (element._debugLifecycleState != _ElementLifecycle.defunct) {
assert(element != null);
assert(element.widget != null);
@@ -224,7 +224,7 @@
if (duplicates != null) {
final List<DiagnosticsNode> information = <DiagnosticsNode>[];
information.add(ErrorSummary('Multiple widgets used the same GlobalKey.'));
- for (GlobalKey key in duplicates.keys) {
+ for (final GlobalKey key in duplicates.keys) {
final Set<Element> elements = duplicates[key];
// TODO(jacobr): this will omit the '- ' before each widget name and
// use the more standard whitespace style instead. Please let me know
@@ -1501,7 +1501,7 @@
'$runtimeType widgets must be placed directly inside $T widgets.\n'
'$description has a $T ancestor, but there are other widgets between them:'
);
- for (Widget ancestor in badAncestors) {
+ for (final Widget ancestor in badAncestors) {
if (ancestor.runtimeType == runtimeType) {
yield ErrorDescription('- $ancestor (this is a different $runtimeType than the one with the problem)');
} else {
@@ -2551,7 +2551,7 @@
return true;
}());
} finally {
- for (Element element in _dirtyElements) {
+ for (final Element element in _dirtyElements) {
assert(element._inDirtyList);
element._inDirtyList = false;
}
@@ -2606,13 +2606,13 @@
if (_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans != null &&
_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans.isNotEmpty) {
final Set<GlobalKey> keys = HashSet<GlobalKey>();
- for (Element element in _debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans.keys) {
+ for (final Element element in _debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans.keys) {
if (element._debugLifecycleState != _ElementLifecycle.defunct)
keys.addAll(_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans[element]);
}
if (keys.isNotEmpty) {
final Map<String, int> keyStringCount = HashMap<String, int>();
- for (String key in keys.map<String>((GlobalKey key) => key.toString())) {
+ for (final String key in keys.map<String>((GlobalKey key) => key.toString())) {
if (keyStringCount.containsKey(key)) {
keyStringCount[key] += 1;
} else {
@@ -2629,7 +2629,7 @@
});
final Iterable<Element> elements = _debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans.keys;
final Map<String, int> elementStringCount = HashMap<String, int>();
- for (String element in elements.map<String>((Element element) => element.toString())) {
+ for (final String element in elements.map<String>((Element element) => element.toString())) {
if (elementStringCount.containsKey(element)) {
elementStringCount[element] += 1;
} else {
@@ -3402,7 +3402,7 @@
assert(depth != null);
assert(_active);
if (_dependencies != null && _dependencies.isNotEmpty) {
- for (InheritedElement dependency in _dependencies)
+ for (final InheritedElement dependency in _dependencies)
dependency._dependents.remove(this);
// For expediency, we don't actually clear the list here, even though it's
// no longer representative of what we are registered with. If we never
@@ -4914,7 +4914,7 @@
@override
void notifyClients(InheritedWidget oldWidget) {
assert(_debugCheckOwnerBuildTargetExists('notifyClients'));
- for (Element dependent in _dependents.keys) {
+ for (final Element dependent in _dependents.keys) {
assert(() {
// check that it really is our descendant
Element ancestor = dependent._parent;
@@ -5329,7 +5329,7 @@
// Clean up any of the remaining middle nodes from the old list.
if (haveOldChildren && oldKeyedChildren.isNotEmpty) {
- for (Element oldChild in oldKeyedChildren.values) {
+ for (final Element oldChild in oldKeyedChildren.values) {
if (forgottenChildren == null || !forgottenChildren.contains(oldChild))
deactivateChild(oldChild);
}
@@ -5612,7 +5612,7 @@
@override
void visitChildren(ElementVisitor visitor) {
- for (Element child in _children) {
+ for (final Element child in _children) {
if (!_forgottenChildren.contains(child))
visitor(child);
}
diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart
index c8e04ea..9febee1 100644
--- a/packages/flutter/lib/src/widgets/gesture_detector.dart
+++ b/packages/flutter/lib/src/widgets/gesture_detector.dart
@@ -990,7 +990,7 @@
@override
void dispose() {
- for (GestureRecognizer recognizer in _recognizers.values)
+ for (final GestureRecognizer recognizer in _recognizers.values)
recognizer.dispose();
_recognizers = null;
super.dispose();
@@ -1000,7 +1000,7 @@
assert(_recognizers != null);
final Map<Type, GestureRecognizer> oldRecognizers = _recognizers;
_recognizers = <Type, GestureRecognizer>{};
- for (Type type in gestures.keys) {
+ for (final Type type in gestures.keys) {
assert(gestures[type] != null);
assert(gestures[type]._debugAssertTypeMatches(type));
assert(!_recognizers.containsKey(type));
@@ -1008,7 +1008,7 @@
assert(_recognizers[type].runtimeType == type, 'GestureRecognizerFactory of type $type created a GestureRecognizer of type ${_recognizers[type].runtimeType}. The GestureRecognizerFactory must be specialized with the type of the class that it returns from its constructor method.');
gestures[type].initializer(_recognizers[type]);
}
- for (Type type in oldRecognizers.keys) {
+ for (final Type type in oldRecognizers.keys) {
if (!_recognizers.containsKey(type))
oldRecognizers[type].dispose();
}
@@ -1016,7 +1016,7 @@
void _handlePointerDown(PointerDownEvent event) {
assert(_recognizers != null);
- for (GestureRecognizer recognizer in _recognizers.values)
+ for (final GestureRecognizer recognizer in _recognizers.values)
recognizer.addPointer(event);
}
diff --git a/packages/flutter/lib/src/widgets/heroes.dart b/packages/flutter/lib/src/widgets/heroes.dart
index 2629cd5..7253e7b 100644
--- a/packages/flutter/lib/src/widgets/heroes.dart
+++ b/packages/flutter/lib/src/widgets/heroes.dart
@@ -755,7 +755,7 @@
// Treat these invalidated flights as dismissed. Calling _handleAnimationUpdate
// will also remove the flight from _flights.
- for (_HeroFlight flight in invalidFlights) {
+ for (final _HeroFlight flight in invalidFlights) {
flight._handleAnimationUpdate(AnimationStatus.dismissed);
}
}
@@ -834,7 +834,7 @@
// animation value back to what it was before it was "moved" offstage.
to.offstage = false;
- for (Object tag in fromHeroes.keys) {
+ for (final Object tag in fromHeroes.keys) {
if (toHeroes[tag] != null) {
final HeroFlightShuttleBuilder fromShuttleBuilder = fromHeroes[tag].widget.flightShuttleBuilder;
final HeroFlightShuttleBuilder toShuttleBuilder = toHeroes[tag].widget.flightShuttleBuilder;
@@ -866,7 +866,7 @@
// If the from hero is gone, the flight won't start and the to hero needs to
// be put on stage again.
- for (Object tag in toHeroes.keys) {
+ for (final Object tag in toHeroes.keys) {
if (fromHeroes[tag] == null)
toHeroes[tag].ensurePlaceholderIsHidden();
}
diff --git a/packages/flutter/lib/src/widgets/inherited_model.dart b/packages/flutter/lib/src/widgets/inherited_model.dart
index a04b870..e4c7efe 100644
--- a/packages/flutter/lib/src/widgets/inherited_model.dart
+++ b/packages/flutter/lib/src/widgets/inherited_model.dart
@@ -170,7 +170,7 @@
}
final InheritedElement lastModel = models.last;
- for (InheritedElement model in models) {
+ for (final InheritedElement model in models) {
final T value = context.dependOnInheritedElement(model, aspect: aspect) as T;
if (model == lastModel)
return value;
diff --git a/packages/flutter/lib/src/widgets/inherited_theme.dart b/packages/flutter/lib/src/widgets/inherited_theme.dart
index ecae20a..dd2a29c 100644
--- a/packages/flutter/lib/src/widgets/inherited_theme.dart
+++ b/packages/flutter/lib/src/widgets/inherited_theme.dart
@@ -147,7 +147,7 @@
@override
Widget build(BuildContext context) {
Widget wrappedChild = child;
- for (InheritedTheme theme in themes)
+ for (final InheritedTheme theme in themes)
wrappedChild = theme.wrap(context, wrappedChild);
return wrappedChild;
}
diff --git a/packages/flutter/lib/src/widgets/list_wheel_scroll_view.dart b/packages/flutter/lib/src/widgets/list_wheel_scroll_view.dart
index b88d196..bced3d0 100644
--- a/packages/flutter/lib/src/widgets/list_wheel_scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/list_wheel_scroll_view.dart
@@ -265,7 +265,7 @@
}
await Future.wait<void>(<Future<void>>[
- for (_FixedExtentScrollPosition position in positions.cast<_FixedExtentScrollPosition>())
+ for (final _FixedExtentScrollPosition position in positions.cast<_FixedExtentScrollPosition>())
position.animateTo(
itemIndex * position.itemExtent,
duration: duration,
@@ -279,7 +279,7 @@
/// Jumps the item index position from its current value to the given value,
/// without animation, and without checking if the new value is in range.
void jumpToItem(int itemIndex) {
- for (_FixedExtentScrollPosition position in positions.cast<_FixedExtentScrollPosition>()) {
+ for (final _FixedExtentScrollPosition position in positions.cast<_FixedExtentScrollPosition>()) {
position.jumpTo(itemIndex * position.itemExtent);
}
}
diff --git a/packages/flutter/lib/src/widgets/localizations.dart b/packages/flutter/lib/src/widgets/localizations.dart
index 5ae0b6e..8dae00d 100644
--- a/packages/flutter/lib/src/widgets/localizations.dart
+++ b/packages/flutter/lib/src/widgets/localizations.dart
@@ -47,14 +47,14 @@
// locale.languageCode.
final Set<Type> types = <Type>{};
final List<LocalizationsDelegate<dynamic>> delegates = <LocalizationsDelegate<dynamic>>[];
- for (LocalizationsDelegate<dynamic> delegate in allDelegates) {
+ for (final LocalizationsDelegate<dynamic> delegate in allDelegates) {
if (!types.contains(delegate.type) && delegate.isSupported(locale)) {
types.add(delegate.type);
delegates.add(delegate);
}
}
- for (LocalizationsDelegate<dynamic> delegate in delegates) {
+ for (final LocalizationsDelegate<dynamic> delegate in delegates) {
final Future<dynamic> inputValue = delegate.load(locale);
dynamic completedValue;
final Future<dynamic> futureValue = inputValue.then<dynamic>((dynamic value) {
diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart
index 344249f..39484aa 100644
--- a/packages/flutter/lib/src/widgets/navigator.dart
+++ b/packages/flutter/lib/src/widgets/navigator.dart
@@ -1521,7 +1521,7 @@
@override
void initState() {
super.initState();
- for (NavigatorObserver observer in widget.observers) {
+ for (final NavigatorObserver observer in widget.observers) {
assert(observer.navigator == null);
observer._navigator = this;
}
@@ -1535,7 +1535,7 @@
final List<String> routeParts = initialRouteName.split('/');
if (initialRouteName.isNotEmpty) {
String routeName = '';
- for (String part in routeParts) {
+ for (final String part in routeParts) {
routeName += '/$part';
plannedInitialRoutes.add(_routeNamed<dynamic>(routeName, allowNull: true, arguments: null));
}
@@ -1564,7 +1564,7 @@
route ??= _routeNamed<Object>(Navigator.defaultRouteName, arguments: null);
push(route);
}
- for (Route<dynamic> route in _history)
+ for (final Route<dynamic> route in _history)
_initialOverlayEntries.addAll(route.overlayEntries);
}
@@ -1572,14 +1572,14 @@
void didUpdateWidget(Navigator oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.observers != widget.observers) {
- for (NavigatorObserver observer in oldWidget.observers)
+ for (final NavigatorObserver observer in oldWidget.observers)
observer._navigator = null;
- for (NavigatorObserver observer in widget.observers) {
+ for (final NavigatorObserver observer in widget.observers) {
assert(observer.navigator == null);
observer._navigator = this;
}
}
- for (Route<dynamic> route in _history)
+ for (final Route<dynamic> route in _history)
route.changedExternalState();
}
@@ -1590,10 +1590,10 @@
_debugLocked = true;
return true;
}());
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer._navigator = null;
final List<Route<dynamic>> doomed = _poppedRoutes.toList()..addAll(_history);
- for (Route<dynamic> route in doomed)
+ for (final Route<dynamic> route in doomed)
route.dispose();
_poppedRoutes.clear();
_history.clear();
@@ -1609,7 +1609,7 @@
OverlayState get overlay => _overlayKey.currentState;
OverlayEntry get _currentOverlayEntry {
- for (Route<dynamic> route in _history.reversed) {
+ for (final Route<dynamic> route in _history.reversed) {
if (route.overlayEntries.isNotEmpty)
return route.overlayEntries.last;
}
@@ -1796,7 +1796,7 @@
oldRoute.didChangeNext(route);
route.didChangePrevious(oldRoute);
}
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didPush(route, oldRoute);
RouteNotificationMessages.maybeNotifyRouteChange(_routePushedMethod, route, oldRoute);
assert(() {
@@ -1896,7 +1896,7 @@
_history[index - 1].didChangeNext(newRoute);
newRoute.didChangePrevious(_history[index - 1]);
}
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
RouteNotificationMessages.maybeNotifyRouteChange(_routeReplacedMethod, newRoute, oldRoute);
assert(() {
@@ -1956,8 +1956,8 @@
newRoute.didPush().whenCompleteOrCancel(() {
if (mounted) {
- for (Route<dynamic> removedRoute in removedRoutes) {
- for (NavigatorObserver observer in widget.observers)
+ for (final Route<dynamic> removedRoute in removedRoutes) {
+ for (final NavigatorObserver observer in widget.observers)
observer.didRemove(removedRoute, newPrecedingRoute);
removedRoute.dispose();
}
@@ -1969,7 +1969,7 @@
// Notify for newRoute
newRoute.didChangeNext(null);
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didPush(newRoute, precedingRoute);
assert(() {
@@ -2020,7 +2020,7 @@
_history[index - 1].didChangeNext(newRoute);
newRoute.didChangePrevious(_history[index - 1]);
}
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
RouteNotificationMessages.maybeNotifyRouteChange(_routeReplacedMethod, newRoute, oldRoute);
oldRoute.dispose();
@@ -2132,7 +2132,7 @@
if (route._navigator != null)
_poppedRoutes.add(route);
_history.last.didPopNext(route);
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didPop(route, _history.last);
RouteNotificationMessages.maybeNotifyRouteChange(_routePoppedMethod, route, _history.last);
} else {
@@ -2190,7 +2190,7 @@
_history.removeAt(index);
previousRoute?.didChangeNext(nextRoute);
nextRoute?.didChangePrevious(previousRoute);
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didRemove(route, previousRoute);
route.dispose();
assert(() {
@@ -2281,7 +2281,7 @@
// Don't operate the _history list since the gesture may be canceled.
// In case of a back swipe, the gesture controller will call .pop() itself.
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didStartUserGesture(route, previousRoute);
}
}
@@ -2294,7 +2294,7 @@
assert(_userGesturesInProgress > 0);
_userGesturesInProgress -= 1;
if (_userGesturesInProgress == 0) {
- for (NavigatorObserver observer in widget.observers)
+ for (final NavigatorObserver observer in widget.observers)
observer.didStopUserGesture();
}
}
diff --git a/packages/flutter/lib/src/widgets/nested_scroll_view.dart b/packages/flutter/lib/src/widgets/nested_scroll_view.dart
index 213f85c..f7397df 100644
--- a/packages/flutter/lib/src/widgets/nested_scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/nested_scroll_view.dart
@@ -497,7 +497,7 @@
}
bool get hasScrolledBody {
- for (_NestedScrollPosition position in _innerPositions) {
+ for (final _NestedScrollPosition position in _innerPositions) {
assert(position.minScrollExtent != null && position.pixels != null);
if (position.pixels > position.minScrollExtent) {
return true;
@@ -520,7 +520,7 @@
return;
_userScrollDirection = value;
_outerPosition.didUpdateScrollDirection(value);
- for (_NestedScrollPosition position in _innerPositions)
+ for (final _NestedScrollPosition position in _innerPositions)
position.didUpdateScrollDirection(value);
}
@@ -529,7 +529,7 @@
void beginActivity(ScrollActivity newOuterActivity, _NestedScrollActivityGetter innerActivityGetter) {
_outerPosition.beginActivity(newOuterActivity);
bool scrolling = newOuterActivity.isScrolling;
- for (_NestedScrollPosition position in _innerPositions) {
+ for (final _NestedScrollPosition position in _innerPositions) {
final ScrollActivity newInnerActivity = innerActivityGetter(position);
position.beginActivity(newInnerActivity);
scrolling = scrolling && newInnerActivity.isScrolling;
@@ -574,7 +574,7 @@
// are heading towards.
_NestedScrollPosition innerPosition;
if (velocity != 0.0) {
- for (_NestedScrollPosition position in _innerPositions) {
+ for (final _NestedScrollPosition position in _innerPositions) {
if (innerPosition != null) {
if (velocity > 0.0) {
if (innerPosition.pixels < position.pixels)
@@ -707,7 +707,7 @@
if (!_outerPosition.haveDimensions)
return;
double maxInnerExtent = 0.0;
- for (_NestedScrollPosition position in _innerPositions) {
+ for (final _NestedScrollPosition position in _innerPositions) {
if (!position.haveDimensions)
return;
maxInnerExtent = math.max(maxInnerExtent, position.maxScrollExtent - position.minScrollExtent);
@@ -744,7 +744,7 @@
void jumpTo(double to) {
goIdle();
_outerPosition.localJumpTo(nestOffset(to, _outerPosition));
- for (_NestedScrollPosition position in _innerPositions)
+ for (final _NestedScrollPosition position in _innerPositions)
position.localJumpTo(nestOffset(to, position));
goBallistic(0.0);
}
@@ -799,7 +799,7 @@
// different levels of overscroll.
final double innerDelta = _outerPosition.applyClampedDragUpdate(delta);
if (innerDelta != 0.0) {
- for (_NestedScrollPosition position in _innerPositions)
+ for (final _NestedScrollPosition position in _innerPositions)
position.applyFullDragUpdate(innerDelta);
}
} else {
@@ -808,7 +808,7 @@
double outerDelta = 0.0; // it will go positive if it changes
final List<double> overscrolls = <double>[];
final List<_NestedScrollPosition> innerPositions = _innerPositions.toList();
- for (_NestedScrollPosition position in innerPositions) {
+ for (final _NestedScrollPosition position in innerPositions) {
final double overscroll = position.applyClampedDragUpdate(delta);
outerDelta = math.max(outerDelta, overscroll);
overscrolls.add(overscroll);
diff --git a/packages/flutter/lib/src/widgets/overlay.dart b/packages/flutter/lib/src/widgets/overlay.dart
index 39b7e57..ec6bc13 100644
--- a/packages/flutter/lib/src/widgets/overlay.dart
+++ b/packages/flutter/lib/src/widgets/overlay.dart
@@ -337,7 +337,7 @@
);
if (entries.isEmpty)
return;
- for (OverlayEntry entry in entries) {
+ for (final OverlayEntry entry in entries) {
assert(entry._overlay == null);
entry._overlay = this;
}
@@ -390,7 +390,7 @@
if (listEquals(_entries, newEntriesList))
return;
final LinkedHashSet<OverlayEntry> old = LinkedHashSet<OverlayEntry>.from(_entries);
- for (OverlayEntry entry in newEntriesList) {
+ for (final OverlayEntry entry in newEntriesList) {
entry._overlay ??= this;
}
setState(() {
@@ -561,7 +561,7 @@
void visitChildren(ElementVisitor visitor) {
if (_onstage != null)
visitor(_onstage);
- for (Element child in _offstage) {
+ for (final Element child in _offstage) {
if (!_forgottenOffstageChildren.contains(child))
visitor(child);
}
diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart
index 850b30b..18ba06c 100644
--- a/packages/flutter/lib/src/widgets/routes.dart
+++ b/packages/flutter/lib/src/widgets/routes.dart
@@ -68,7 +68,7 @@
@override
void dispose() {
- for (OverlayEntry entry in _overlayEntries)
+ for (final OverlayEntry entry in _overlayEntries)
entry.remove();
_overlayEntries.clear();
super.dispose();
@@ -1131,7 +1131,7 @@
Future<RoutePopDisposition> willPop() async {
final _ModalScopeState<T> scope = _scopeKey.currentState;
assert(scope != null);
- for (WillPopCallback callback in List<WillPopCallback>.from(_willPopCallbacks)) {
+ for (final WillPopCallback callback in List<WillPopCallback>.from(_willPopCallbacks)) {
if (!await callback())
return RoutePopDisposition.doNotPop;
}
@@ -1446,7 +1446,7 @@
/// subscribed to multiple types, this will unregister it (once) from each type.
void unsubscribe(RouteAware routeAware) {
assert(routeAware != null);
- for (R route in _listeners.keys) {
+ for (final R route in _listeners.keys) {
final Set<RouteAware> subscribers = _listeners[route];
subscribers?.remove(routeAware);
}
@@ -1458,7 +1458,7 @@
final List<RouteAware> previousSubscribers = _listeners[previousRoute]?.toList();
if (previousSubscribers != null) {
- for (RouteAware routeAware in previousSubscribers) {
+ for (final RouteAware routeAware in previousSubscribers) {
routeAware.didPopNext();
}
}
@@ -1466,7 +1466,7 @@
final List<RouteAware> subscribers = _listeners[route]?.toList();
if (subscribers != null) {
- for (RouteAware routeAware in subscribers) {
+ for (final RouteAware routeAware in subscribers) {
routeAware.didPop();
}
}
@@ -1479,7 +1479,7 @@
final Set<RouteAware> previousSubscribers = _listeners[previousRoute];
if (previousSubscribers != null) {
- for (RouteAware routeAware in previousSubscribers) {
+ for (final RouteAware routeAware in previousSubscribers) {
routeAware.didPushNext();
}
}
diff --git a/packages/flutter/lib/src/widgets/scroll_controller.dart b/packages/flutter/lib/src/widgets/scroll_controller.dart
index 88fdb31..35c1b1f 100644
--- a/packages/flutter/lib/src/widgets/scroll_controller.dart
+++ b/packages/flutter/lib/src/widgets/scroll_controller.dart
@@ -168,7 +168,7 @@
/// value was out of range.
void jumpTo(double value) {
assert(_positions.isNotEmpty, 'ScrollController not attached to any scroll views.');
- for (ScrollPosition position in List<ScrollPosition>.from(_positions))
+ for (final ScrollPosition position in List<ScrollPosition>.from(_positions))
position.jumpTo(value);
}
@@ -194,7 +194,7 @@
@override
void dispose() {
- for (ScrollPosition position in _positions)
+ for (final ScrollPosition position in _positions)
position.removeListener(notifyListeners);
super.dispose();
}
@@ -367,7 +367,7 @@
@override
void dispose() {
- for (ScrollPosition position in positions) {
+ for (final ScrollPosition position in positions) {
assert(_positionToListener.containsKey(position));
position.removeListener(_positionToListener[position]);
}
diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart
index 193d8be..cbf6de6 100644
--- a/packages/flutter/lib/src/widgets/scrollable.dart
+++ b/packages/flutter/lib/src/widgets/scrollable.dart
@@ -763,7 +763,7 @@
int firstVisibleIndex;
final List<SemanticsNode> excluded = <SemanticsNode>[_innerNode];
final List<SemanticsNode> included = <SemanticsNode>[];
- for (SemanticsNode child in children) {
+ for (final SemanticsNode child in children) {
assert(child.isTagged(RenderViewport.useTwoPaneSemantics));
if (child.isTagged(RenderViewport.excludeFromScrolling)) {
excluded.add(child);
diff --git a/packages/flutter/lib/src/widgets/shortcuts.dart b/packages/flutter/lib/src/widgets/shortcuts.dart
index f34e0f6..351ef11 100644
--- a/packages/flutter/lib/src/widgets/shortcuts.dart
+++ b/packages/flutter/lib/src/widgets/shortcuts.dart
@@ -196,7 +196,7 @@
// have synonyms in the map. This is for things like left and right shift
// keys mapping to just the "shift" pseudo-key.
final Set<LogicalKeyboardKey> pseudoKeys = <LogicalKeyboardKey>{};
- for (LogicalKeyboardKey setKey in keySet.keys) {
+ for (final LogicalKeyboardKey setKey in keySet.keys) {
final Set<LogicalKeyboardKey> synonyms = setKey.synonyms;
if (synonyms.isNotEmpty) {
// There currently aren't any synonyms that match more than one key.
diff --git a/packages/flutter/lib/src/widgets/sliver.dart b/packages/flutter/lib/src/widgets/sliver.dart
index 9b4a89c..92fe47f 100644
--- a/packages/flutter/lib/src/widgets/sliver.dart
+++ b/packages/flutter/lib/src/widgets/sliver.dart
@@ -1229,7 +1229,7 @@
}
}
- for (int index in _childElements.keys.toList()) {
+ for (final int index in _childElements.keys.toList()) {
final Key key = _childElements[index].widget.key;
final int newIndex = key == null ? null : widget.delegate.findIndexByKey(key);
if (newIndex != null && newIndex != index) {
diff --git a/packages/flutter/lib/src/widgets/table.dart b/packages/flutter/lib/src/widgets/table.dart
index 3eec4b7..965a70a 100644
--- a/packages/flutter/lib/src/widgets/table.dart
+++ b/packages/flutter/lib/src/widgets/table.dart
@@ -285,7 +285,7 @@
@override
void update(Table newWidget) {
final Map<LocalKey, List<Element>> oldKeyedRows = <LocalKey, List<Element>>{};
- for (_TableElementRow row in _children) {
+ for (final _TableElementRow row in _children) {
if (row.key != null) {
oldKeyedRows[row.key] = row.children;
}
@@ -293,7 +293,7 @@
final Iterator<_TableElementRow> oldUnkeyedRows = _children.where((_TableElementRow row) => row.key == null).iterator;
final List<_TableElementRow> newChildren = <_TableElementRow>[];
final Set<List<Element>> taken = <List<Element>>{};
- for (TableRow row in newWidget.children) {
+ for (final TableRow row in newWidget.children) {
List<Element> oldChildren;
if (row.key != null && oldKeyedRows.containsKey(row.key)) {
oldChildren = oldKeyedRows[row.key];
@@ -310,7 +310,7 @@
}
while (oldUnkeyedRows.moveNext())
updateChildren(oldUnkeyedRows.current.children, const <Widget>[], forgottenChildren: _forgottenChildren);
- for (List<Element> oldChildren in oldKeyedRows.values.where((List<Element> list) => !taken.contains(list)))
+ for (final List<Element> oldChildren in oldKeyedRows.values.where((List<Element> list) => !taken.contains(list)))
updateChildren(oldChildren, const <Widget>[], forgottenChildren: _forgottenChildren);
_children = newChildren;
@@ -335,7 +335,7 @@
@override
void visitChildren(ElementVisitor visitor) {
- for (Element child in _children.expand<Element>((_TableElementRow row) => row.children)) {
+ for (final Element child in _children.expand<Element>((_TableElementRow row) => row.children)) {
if (!_forgottenChildren.contains(child))
visitor(child);
}
diff --git a/packages/flutter/lib/src/widgets/ticker_provider.dart b/packages/flutter/lib/src/widgets/ticker_provider.dart
index 392ac56..65a8254 100644
--- a/packages/flutter/lib/src/widgets/ticker_provider.dart
+++ b/packages/flutter/lib/src/widgets/ticker_provider.dart
@@ -180,7 +180,7 @@
void dispose() {
assert(() {
if (_tickers != null) {
- for (Ticker ticker in _tickers) {
+ for (final Ticker ticker in _tickers) {
if (ticker.isActive) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('$this was disposed with an active Ticker.'),
@@ -208,7 +208,7 @@
void didChangeDependencies() {
final bool muted = !TickerMode.of(context);
if (_tickers != null) {
- for (Ticker ticker in _tickers) {
+ for (final Ticker ticker in _tickers) {
ticker.muted = muted;
}
}
diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart
index cff08a1..d113c75 100644
--- a/packages/flutter/lib/src/widgets/widget_inspector.dart
+++ b/packages/flutter/lib/src/widgets/widget_inspector.dart
@@ -1440,7 +1440,7 @@
// https://github.com/flutter/flutter/issues/32660 is fixed.
return !file.contains('packages/flutter/');
}
- for (String directory in _pubRootDirectories) {
+ for (final String directory in _pubRootDirectories) {
if (file.startsWith(directory)) {
return true;
}
@@ -1573,7 +1573,7 @@
InspectorSerializationDelegate delegate,
) {
final List<DiagnosticsNode> children = <DiagnosticsNode>[
- for (DiagnosticsNode child in nodes)
+ for (final DiagnosticsNode child in nodes)
if (!delegate.summaryTree || _shouldShowInSummaryTree(child))
child
else
@@ -1781,7 +1781,7 @@
Element current = selection?.currentElement;
if (current != null && !_isValueCreatedByLocalProject(current)) {
Element firstLocal;
- for (Element candidate in current.debugGetDiagnosticChain()) {
+ for (final Element candidate in current.debugGetDiagnosticChain()) {
if (_isValueCreatedByLocalProject(candidate)) {
firstLocal = candidate;
break;
@@ -2003,7 +2003,7 @@
// trigger significant additional memory allocations. Avoiding memory
// allocations is important to minimize the impact this class has on cpu
// and memory performance of the running app.
- for (_LocationCount entry in active) {
+ for (final _LocationCount entry in active) {
entry.reset();
}
active.clear();
@@ -2014,7 +2014,7 @@
Map<String, dynamic> exportToJson(Duration startTime) {
final List<int> events = List<int>.filled(active.length * 2, 0);
int j = 0;
- for (_LocationCount stat in active) {
+ for (final _LocationCount stat in active) {
events[j++] = stat.id;
events[j++] = stat.count;
}
@@ -2027,7 +2027,7 @@
if (newLocations.isNotEmpty) {
// Add all newly used location ids to the JSON.
final Map<String, List<int>> locationsJson = <String, List<int>>{};
- for (_LocationCount entry in newLocations) {
+ for (final _LocationCount entry in newLocations) {
final _Location location = entry.location;
final List<int> jsonForFile = locationsJson.putIfAbsent(
location.file,
@@ -2537,7 +2537,7 @@
final RenderObject selected = selection.current;
final List<_TransformedRect> candidates = <_TransformedRect>[];
- for (RenderObject candidate in selection.candidates) {
+ for (final RenderObject candidate in selection.candidates) {
if (candidate == selected || !candidate.attached)
continue;
candidates.add(_TransformedRect(candidate));
@@ -2584,7 +2584,7 @@
// Show all other candidate possibly selected elements. This helps selecting
// render objects by selecting the edge of the bounding box shows all
// elements the user could toggle the selection between.
- for (_TransformedRect transformedRect in state.candidates) {
+ for (final _TransformedRect transformedRect in state.candidates) {
canvas
..save()
..transform(transformedRect.transform.storage)
@@ -2767,7 +2767,7 @@
Iterable<DiagnosticsNode> transformDebugCreator(Iterable<DiagnosticsNode> properties) sync* {
final List<DiagnosticsNode> pending = <DiagnosticsNode>[];
bool foundStackTrace = false;
- for (DiagnosticsNode node in properties) {
+ for (final DiagnosticsNode node in properties) {
if (!foundStackTrace && node is DiagnosticsStackTrace)
foundStackTrace = true;
if (_isDebugCreator(node)) {
diff --git a/packages/flutter/test/foundation/diagnostics_json_test.dart b/packages/flutter/test/foundation/diagnostics_json_test.dart
index e035994..4a52f77 100644
--- a/packages/flutter/test/foundation/diagnostics_json_test.dart
+++ b/packages/flutter/test/foundation/diagnostics_json_test.dart
@@ -247,7 +247,7 @@
@override
List<DiagnosticsNode> debugDescribeChildren() => <DiagnosticsNode>[
- for (TestTree child in children)
+ for (final TestTree child in children)
child.toDiagnosticsNode(
name: 'child ${child.name}',
style: child.style,
diff --git a/packages/flutter/test/foundation/diagnostics_test.dart b/packages/flutter/test/foundation/diagnostics_test.dart
index 09246b7..2ab97c8 100644
--- a/packages/flutter/test/foundation/diagnostics_test.dart
+++ b/packages/flutter/test/foundation/diagnostics_test.dart
@@ -23,7 +23,7 @@
@override
List<DiagnosticsNode> debugDescribeChildren() => <DiagnosticsNode>[
- for (TestTree child in children)
+ for (final TestTree child in children)
child.toDiagnosticsNode(
name: 'child ${child.name}',
style: child.style,
diff --git a/packages/flutter/test/gestures/gesture_binding_test.dart b/packages/flutter/test/gestures/gesture_binding_test.dart
index 1bd207d..41574f1 100644
--- a/packages/flutter/test/gestures/gesture_binding_test.dart
+++ b/packages/flutter/test/gestures/gesture_binding_test.dart
@@ -205,7 +205,7 @@
test('Should synthesize kPrimaryButton for stylus', () {
final Offset location = const Offset(10.0, 10.0) * ui.window.devicePixelRatio;
- for (PointerDeviceKind kind in <PointerDeviceKind>[
+ for (final PointerDeviceKind kind in <PointerDeviceKind>[
PointerDeviceKind.stylus,
PointerDeviceKind.invertedStylus,
]) {
@@ -268,7 +268,7 @@
test('Should not synthesize kPrimaryButton for mouse', () {
final Offset location = const Offset(10.0, 10.0) * ui.window.devicePixelRatio;
- for (PointerDeviceKind kind in <PointerDeviceKind>[
+ for (final PointerDeviceKind kind in <PointerDeviceKind>[
PointerDeviceKind.mouse,
]) {
final ui.PointerDataPacket packet = ui.PointerDataPacket(
diff --git a/packages/flutter/test/gestures/velocity_tracker_test.dart b/packages/flutter/test/gestures/velocity_tracker_test.dart
index b1e4c32..8032867 100644
--- a/packages/flutter/test/gestures/velocity_tracker_test.dart
+++ b/packages/flutter/test/gestures/velocity_tracker_test.dart
@@ -38,7 +38,7 @@
test('Velocity tracker gives expected results', () {
final VelocityTracker tracker = VelocityTracker();
int i = 0;
- for (PointerEvent event in velocityEventData) {
+ for (final PointerEvent event in velocityEventData) {
if (event is PointerDownEvent || event is PointerMoveEvent)
tracker.addPosition(event.timeStamp, event.position);
if (event is PointerUpEvent) {
@@ -63,7 +63,7 @@
test('Interrupted velocity estimation', () {
// Regression test for https://github.com/flutter/flutter/pull/7510
final VelocityTracker tracker = VelocityTracker();
- for (PointerEvent event in interruptedVelocityEventData) {
+ for (final PointerEvent event in interruptedVelocityEventData) {
if (event is PointerDownEvent || event is PointerMoveEvent)
tracker.addPosition(event.timeStamp, event.position);
if (event is PointerUpEvent) {
diff --git a/packages/flutter/test/material/colors_test.dart b/packages/flutter/test/material/colors_test.dart
index d0e4209..a9f33bb 100644
--- a/packages/flutter/test/material/colors_test.dart
+++ b/packages/flutter/test/material/colors_test.dart
@@ -53,31 +53,31 @@
});
test('Colors swatches do not contain duplicates', () {
- for (MaterialColor color in Colors.primaries)
+ for (final MaterialColor color in Colors.primaries)
expect(primaryKeys.map<Color>((int key) => color[key]).toSet().length, primaryKeys.length);
expect(primaryKeys.map<Color>((int key) => Colors.grey[key]).toSet().length, primaryKeys.length);
- for (MaterialAccentColor color in Colors.accents)
+ for (final MaterialAccentColor color in Colors.accents)
expect(accentKeys.map<Color>((int key) => color[key]).toSet().length, accentKeys.length);
});
test('All color swatch colors are opaque and equal their primary color', () {
- for (MaterialColor color in Colors.primaries) {
+ for (final MaterialColor color in Colors.primaries) {
expect(color.value, color.shade500.value);
- for (int key in primaryKeys) {
+ for (final int key in primaryKeys) {
expect(color[key].alpha, 0xFF);
}
}
expect(Colors.grey.value, Colors.grey.shade500.value);
- for (int key in primaryKeys) {
+ for (final int key in primaryKeys) {
expect(Colors.grey[key].alpha, 0xFF);
}
- for (MaterialAccentColor color in Colors.accents) {
+ for (final MaterialAccentColor color in Colors.accents) {
expect(color.value, color.shade200.value);
- for (int key in accentKeys) {
+ for (final int key in accentKeys) {
expect(color[key].alpha, 0xFF);
}
}
diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart
index b2cd46b..7b683c8 100644
--- a/packages/flutter/test/material/date_picker_test.dart
+++ b/packages/flutter/test/material/date_picker_test.dart
@@ -742,7 +742,7 @@
// Initial chevron animation state should be dismissed
// An AlwaysStoppedAnimation is also found and is ignored
- for (RenderAnimatedOpacity renderer in chevronRenderers) {
+ for (final RenderAnimatedOpacity renderer in chevronRenderers) {
expect(renderer.opacity.value, equals(1.0));
expect(renderer.opacity.status, equals(AnimationStatus.dismissed));
}
@@ -751,7 +751,7 @@
final TestGesture gesture = await tester.startGesture(const Offset(100.0, 100.0));
await gesture.moveBy(const Offset(50.0, 100.0));
await tester.pumpAndSettle();
- for (RenderAnimatedOpacity renderer in chevronRenderers) {
+ for (final RenderAnimatedOpacity renderer in chevronRenderers) {
expect(renderer.opacity.value, equals(0.0));
expect(renderer.opacity.status, equals(AnimationStatus.completed));
}
@@ -759,7 +759,7 @@
// Release the drag and test for the opacity to return to original value
await gesture.up();
await tester.pumpAndSettle();
- for (RenderAnimatedOpacity renderer in chevronRenderers) {
+ for (final RenderAnimatedOpacity renderer in chevronRenderers) {
expect(renderer.opacity.value, equals(1.0));
expect(renderer.opacity.status, equals(AnimationStatus.dismissed));
}
diff --git a/packages/flutter/test/material/dropdown_form_field_test.dart b/packages/flutter/test/material/dropdown_form_field_test.dart
index ef98d30..5ad34d7 100644
--- a/packages/flutter/test/material/dropdown_form_field_test.dart
+++ b/packages/flutter/test/material/dropdown_form_field_test.dart
@@ -264,7 +264,7 @@
final double menuItemHeight = itemBoxesHeight.reduce(math.max);
expect(menuItemHeight, greaterThanOrEqualTo(buttonBox.size.height));
- for (RenderBox itemBox in itemBoxes) {
+ for (final RenderBox itemBox in itemBoxes) {
expect(itemBox.attached, isTrue);
final Offset buttonBoxCenter = buttonBox.size.center(buttonBox.localToGlobal(Offset.zero));
final Offset itemBoxCenter = itemBox.size.center(itemBox.localToGlobal(Offset.zero));
diff --git a/packages/flutter/test/material/dropdown_test.dart b/packages/flutter/test/material/dropdown_test.dart
index b8c6e81..795822c 100644
--- a/packages/flutter/test/material/dropdown_test.dart
+++ b/packages/flutter/test/material/dropdown_test.dart
@@ -447,7 +447,7 @@
await tester.pump(const Duration(seconds: 1)); // finish the menu animation
});
- for (TextDirection textDirection in TextDirection.values) {
+ for (final TextDirection textDirection in TextDirection.values) {
testWidgets('Dropdown button aligns selected menu item ($textDirection)', (WidgetTester tester) async {
final Key buttonKey = UniqueKey();
const String value = 'two';
@@ -471,7 +471,7 @@
// have the same origin and height as the dropdown button.
final List<RenderBox> itemBoxes = tester.renderObjectList<RenderBox>(find.byKey(const ValueKey<String>('two'))).toList();
expect(itemBoxes.length, equals(2));
- for (RenderBox itemBox in itemBoxes) {
+ for (final RenderBox itemBox in itemBoxes) {
assert(itemBox.attached);
assert(textDirection != null);
switch (textDirection) {
@@ -664,7 +664,7 @@
final double menuItemHeight = itemBoxes.map<double>((RenderBox box) => box.size.height).reduce(math.max);
expect(menuItemHeight, greaterThan(buttonBox.size.height));
- for (RenderBox itemBox in itemBoxes) {
+ for (final RenderBox itemBox in itemBoxes) {
assert(itemBox.attached);
final Offset buttonBoxCenter = buttonBox.size.center(buttonBox.localToGlobal(Offset.zero));
final Offset itemBoxCenter = itemBox.size.center(itemBox.localToGlobal(Offset.zero));
diff --git a/packages/flutter/test/material/floating_action_button_location_test.dart b/packages/flutter/test/material/floating_action_button_location_test.dart
index e898bb5..264e719 100644
--- a/packages/flutter/test/material/floating_action_button_location_test.dart
+++ b/packages/flutter/test/material/floating_action_button_location_test.dart
@@ -137,9 +137,9 @@
&& currentRotations != null && currentRotations.isNotEmpty
&& previousRect != null && currentRect != null) {
final List<double> deltas = <double>[];
- for (double currentRotation in currentRotations) {
+ for (final double currentRotation in currentRotations) {
double minDelta;
- for (double previousRotation in previousRotations) {
+ for (final double previousRotation in previousRotations) {
final double delta = (previousRotation - currentRotation).abs();
minDelta ??= delta;
minDelta = min(delta, minDelta);
diff --git a/packages/flutter/test/material/material_test.dart b/packages/flutter/test/material/material_test.dart
index a862fd4..c48b3b7 100644
--- a/packages/flutter/test/material/material_test.dart
+++ b/packages/flutter/test/material/material_test.dart
@@ -251,7 +251,7 @@
ElevationColor(24.0, Color(0xFF20362B)),
];
- for (ElevationColor test in elevationColors) {
+ for (final ElevationColor test in elevationColors) {
await tester.pumpWidget(
Theme(
data: ThemeData(
diff --git a/packages/flutter/test/material/page_selector_test.dart b/packages/flutter/test/material/page_selector_test.dart
index 43be2d7..35e24dc 100644
--- a/packages/flutter/test/material/page_selector_test.dart
+++ b/packages/flutter/test/material/page_selector_test.dart
@@ -212,7 +212,7 @@
).evaluate();
// Indicators get an 8 pixel margin, 16 + 8 = 24.
- for (Element indicatorElement in indicatorElements)
+ for (final Element indicatorElement in indicatorElements)
expect(indicatorElement.size, const Size(24.0, 24.0));
expect(tester.getSize(find.byType(TabPageSelector)).height, 24.0);
diff --git a/packages/flutter/test/material/reorderable_list_test.dart b/packages/flutter/test/material/reorderable_list_test.dart
index 8ae3472..94568e8 100644
--- a/packages/flutter/test/material/reorderable_list_test.dart
+++ b/packages/flutter/test/material/reorderable_list_test.dart
@@ -316,7 +316,7 @@
testWidgets('Provides the correct accessibility actions in LTR and RTL modes', (WidgetTester tester) async {
// The a11y actions for a vertical list are the same in LTR and RTL modes.
final SemanticsHandle handle = tester.ensureSemantics();
- for (TextDirection direction in TextDirection.values) {
+ for (final TextDirection direction in TextDirection.values) {
await tester.pumpWidget(build());
// The first item can be moved down or to the end.
diff --git a/packages/flutter/test/material/theme_data_test.dart b/packages/flutter/test/material/theme_data_test.dart
index fbad907..041ed51 100644
--- a/packages/flutter/test/material/theme_data_test.dart
+++ b/packages/flutter/test/material/theme_data_test.dart
@@ -21,7 +21,7 @@
});
test('Defaults to the default typography for the platform', () {
- for (TargetPlatform platform in TargetPlatform.values) {
+ for (final TargetPlatform platform in TargetPlatform.values) {
final ThemeData theme = ThemeData(platform: platform);
final Typography typography = Typography(platform: platform);
expect(theme.textTheme, typography.black.apply(decoration: TextDecoration.none),
diff --git a/packages/flutter/test/material/theme_test.dart b/packages/flutter/test/material/theme_test.dart
index dd9513c..837ec1a 100644
--- a/packages/flutter/test/material/theme_test.dart
+++ b/packages/flutter/test/material/theme_test.dart
@@ -148,7 +148,7 @@
await tester.tap(find.byKey(dropdownMenuButtonKey));
await tester.pump(const Duration(seconds: 1));
- for (Element item in tester.elementList(find.text('menuItem')))
+ for (final Element item in tester.elementList(find.text('menuItem')))
expect(Theme.of(item).brightness, equals(Brightness.light));
});
@@ -390,8 +390,8 @@
];
}
- for (TextTheme textTheme in <TextTheme>[theme.textTheme, theme.primaryTextTheme, theme.accentTextTheme]) {
- for (TextStyle style in extractStyles(textTheme).map<TextStyle>((TextStyle style) => _TextStyleProxy(style))) {
+ for (final TextTheme textTheme in <TextTheme>[theme.textTheme, theme.primaryTextTheme, theme.accentTextTheme]) {
+ for (final TextStyle style in extractStyles(textTheme).map<TextStyle>((TextStyle style) => _TextStyleProxy(style))) {
expect(style.inherit, false);
expect(style.color, isNotNull);
expect(style.fontFamily, isNotNull);
diff --git a/packages/flutter/test/material/time_picker_test.dart b/packages/flutter/test/material/time_picker_test.dart
index 4be6efd..d5a4d43 100644
--- a/packages/flutter/test/material/time_picker_test.dart
+++ b/packages/flutter/test/material/time_picker_test.dart
@@ -734,7 +734,7 @@
final PaintPattern expectedLabels = paints;
int i = 0;
- for (_SemanticsNodeExpectation expectation in expectedNodes) {
+ for (final _SemanticsNodeExpectation expectation in expectedNodes) {
expect(semantics, includesNodeWith(value: expectation.label));
final Iterable<SemanticsNode> dialLabelNodes = semantics
.nodesWith(value: expectation.label)
diff --git a/packages/flutter/test/material/typography_test.dart b/packages/flutter/test/material/typography_test.dart
index c4c642d..726f2c4 100644
--- a/packages/flutter/test/material/typography_test.dart
+++ b/packages/flutter/test/material/typography_test.dart
@@ -8,7 +8,7 @@
void main() {
test('Typography is defined for all target platforms', () {
- for (TargetPlatform platform in TargetPlatform.values) {
+ for (final TargetPlatform platform in TargetPlatform.values) {
final Typography typography = Typography(platform: platform);
expect(typography, isNotNull, reason: 'null typography for $platform');
expect(typography.black, isNotNull, reason: 'null black typography for $platform');
@@ -32,7 +32,7 @@
}, 'Uses SF Text font');
final Typography typography = Typography(platform: TargetPlatform.iOS);
- for (TextTheme textTheme in <TextTheme>[typography.black, typography.white]) {
+ for (final TextTheme textTheme in <TextTheme>[typography.black, typography.white]) {
expect(textTheme.display4, isDisplayFont);
expect(textTheme.display3, isDisplayFont);
expect(textTheme.display2, isDisplayFont);
diff --git a/packages/flutter/test/painting/alignment_test.dart b/packages/flutter/test/painting/alignment_test.dart
index fd487f2..15691d6 100644
--- a/packages/flutter/test/painting/alignment_test.dart
+++ b/packages/flutter/test/painting/alignment_test.dart
@@ -57,14 +57,14 @@
expect(topEnd * 1.0, topEnd);
expect(topLeft * 1.0, topLeft);
expect(topRight * 1.0, topRight);
- for (double n in numbers) {
+ for (final double n in numbers) {
expect((topStart * n).add(topStart), topStart * (n + 1.0));
expect((topEnd * n).add(topEnd), topEnd * (n + 1.0));
- for (double m in numbers)
+ for (final double m in numbers)
expect((topStart * n).add(topStart * m), topStart * (n + m));
}
expect(topStart + topStart + topStart, topStart * 3.0); // without using "add"
- for (TextDirection x in TextDirection.values) {
+ for (final TextDirection x in TextDirection.values) {
expect((topEnd * 0.0).add(topRight * 0.0).resolve(x), center.add(center).resolve(x));
expect((topEnd * 0.0).add(topLeft).resolve(x), center.add(topLeft).resolve(x));
expect(((topEnd * 0.0).resolve(x)).add(topLeft.resolve(x)), (center.resolve(x)).add(topLeft.resolve(x)));
@@ -107,7 +107,7 @@
final AlignmentGeometry mixed2 = const Alignment(70.0, 110.0).add(const AlignmentDirectional(130.0, 170.0));
final AlignmentGeometry mixed3 = const Alignment(25.0, 42.5).add(const AlignmentDirectional(55.0, 80.0));
- for (TextDirection direction in TextDirection.values) {
+ for (final TextDirection direction in TextDirection.values) {
expect(AlignmentGeometry.lerp(mixed1, mixed2, 0.0).resolve(direction), mixed1.resolve(direction));
expect(AlignmentGeometry.lerp(mixed1, mixed2, 1.0).resolve(direction), mixed2.resolve(direction));
expect(AlignmentGeometry.lerp(mixed1, mixed2, 0.25).resolve(direction), mixed3.resolve(direction));
@@ -150,17 +150,17 @@
final List<double> times = <double>[ 0.25, 0.5, 0.75 ];
- for (TextDirection direction in TextDirection.values) {
+ for (final TextDirection direction in TextDirection.values) {
final Alignment defaultValue = AlignmentDirectional.center.resolve(direction);
- for (AlignmentGeometry a in offsets) {
+ for (final AlignmentGeometry a in offsets) {
final Alignment resolvedA = a?.resolve(direction) ?? defaultValue;
- for (AlignmentGeometry b in offsets) {
+ for (final AlignmentGeometry b in offsets) {
final Alignment resolvedB = b?.resolve(direction) ?? defaultValue;
approxExpect(Alignment.lerp(resolvedA, resolvedB, 0.0), resolvedA);
approxExpect(Alignment.lerp(resolvedA, resolvedB, 1.0), resolvedB);
approxExpect((AlignmentGeometry.lerp(a, b, 0.0) ?? defaultValue).resolve(direction), resolvedA);
approxExpect((AlignmentGeometry.lerp(a, b, 1.0) ?? defaultValue).resolve(direction), resolvedB);
- for (double t in times) {
+ for (final double t in times) {
assert(t > 0.0);
assert(t < 1.0);
final Alignment value = (AlignmentGeometry.lerp(a, b, t) ?? defaultValue).resolve(direction);
@@ -191,7 +191,7 @@
expect(const AlignmentDirectional(1.0, 2.0) / 2.0, const AlignmentDirectional(0.5, 1.0));
expect(const AlignmentDirectional(1.0, 2.0) % 2.0, const AlignmentDirectional(1.0, 0.0));
expect(const AlignmentDirectional(1.0, 2.0) ~/ 2.0, const AlignmentDirectional(0.0, 1.0));
- for (TextDirection direction in TextDirection.values) {
+ for (final TextDirection direction in TextDirection.values) {
expect(Alignment.center.add(const AlignmentDirectional(1.0, 2.0) * 2.0).resolve(direction), const AlignmentDirectional(2.0, 4.0).resolve(direction));
expect(Alignment.center.add(const AlignmentDirectional(1.0, 2.0) / 2.0).resolve(direction), const AlignmentDirectional(0.5, 1.0).resolve(direction));
expect(Alignment.center.add(const AlignmentDirectional(1.0, 2.0) % 2.0).resolve(direction), const AlignmentDirectional(1.0, 0.0).resolve(direction));
diff --git a/packages/flutter/test/painting/decoration_test.dart b/packages/flutter/test/painting/decoration_test.dart
index b869fee..1e1b661 100644
--- a/packages/flutter/test/painting/decoration_test.dart
+++ b/packages/flutter/test/painting/decoration_test.dart
@@ -521,7 +521,7 @@
BoxFit.scaleDown,
];
- for (BoxFit boxFit in boxFits) {
+ for (final BoxFit boxFit in boxFits) {
final TestCanvas canvas = TestCanvas(<Invocation>[]);
const Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0);
diff --git a/packages/flutter/test/painting/gradient_test.dart b/packages/flutter/test/painting/gradient_test.dart
index d47a164..41bd3e7 100644
--- a/packages/flutter/test/painting/gradient_test.dart
+++ b/packages/flutter/test/painting/gradient_test.dart
@@ -814,13 +814,13 @@
}
testWidgets('Gradients - 45 degrees', (WidgetTester tester) async {
- for (Gradient gradient in gradients45) {
+ for (final Gradient gradient in gradients45) {
await runTest(tester, gradient, 45);
}
}, skip: isBrowser); // TODO(yjbanov): web does not support golden tests yet: https://github.com/flutter/flutter/issues/40297
testWidgets('Gradients - 90 degrees', (WidgetTester tester) async {
- for (Gradient gradient in gradients90) {
+ for (final Gradient gradient in gradients90) {
await runTest(tester, gradient, 90);
}
}, skip: isBrowser); // TODO(yjbanov): web does not support golden tests yet: https://github.com/flutter/flutter/issues/40297
diff --git a/packages/flutter/test/painting/text_painter_test.dart b/packages/flutter/test/painting/text_painter_test.dart
index e7063ea..e2996f0 100644
--- a/packages/flutter/test/painting/text_painter_test.dart
+++ b/packages/flutter/test/painting/text_painter_test.dart
@@ -749,7 +749,7 @@
// be removed when it is no longer useful.
if (lines[1].hardBreak == true) {
print('LineMetrics called: ${lines.length}');
- for (ui.LineMetrics line in lines) {
+ for (final ui.LineMetrics line in lines) {
print('${line.lineNumber}: ${line.hardBreak}');
}
}
diff --git a/packages/flutter/test/rendering/annotated_region_test.dart b/packages/flutter/test/rendering/annotated_region_test.dart
index 29dc34b..81f696d 100644
--- a/packages/flutter/test/rendering/annotated_region_test.dart
+++ b/packages/flutter/test/rendering/annotated_region_test.dart
@@ -16,7 +16,7 @@
OffsetLayer(offset: const Offset(0.0, 200.0)),
];
int i = 0;
- for (OffsetLayer layer in layers) {
+ for (final OffsetLayer layer in layers) {
layer.append(AnnotatedRegionLayer<int>(i, size: const Size(200.0, 100.0)));
containerLayer.append(layer);
i += 1;
@@ -35,7 +35,7 @@
ClipRectLayer(clipRect: const Rect.fromLTRB(0.0, 200.0, 100.0, 300.0)),
];
int i = 0;
- for (ClipRectLayer layer in layers) {
+ for (final ClipRectLayer layer in layers) {
layer.append(AnnotatedRegionLayer<int>(i));
containerLayer.append(layer);
i += 1;
@@ -55,7 +55,7 @@
ClipRRectLayer(clipRRect: RRect.fromLTRBR(0.0, 200.0, 100.0, 300.0, const Radius.circular(4.0))),
];
int i = 0;
- for (ClipRRectLayer layer in layers) {
+ for (final ClipRRectLayer layer in layers) {
layer.append(AnnotatedRegionLayer<int>(i));
containerLayer.append(layer);
i += 1;
@@ -80,7 +80,7 @@
OffsetLayer(offset: const Offset(0.0, 200.0)),
];
int i = 0;
- for (OffsetLayer layer in layers) {
+ for (final OffsetLayer layer in layers) {
final AnnotatedRegionLayer<int> annotatedRegionLayer = AnnotatedRegionLayer<int>(i, size: const Size(100.0, 100.0));
layer.append(annotatedRegionLayer);
transformLayer.append(layer);
@@ -145,7 +145,7 @@
OffsetLayer(offset: const Offset(0.0, 200.0)),
];
int i = 0;
- for (OffsetLayer layer in layers) {
+ for (final OffsetLayer layer in layers) {
layer.append(AnnotatedRegionLayer<int>(i, size: const Size(200.0, 100.0)));
containerLayer.append(layer);
i += 1;
@@ -164,7 +164,7 @@
ClipRectLayer(clipRect: const Rect.fromLTRB(0.0, 200.0, 100.0, 300.0)),
];
int i = 0;
- for (ClipRectLayer layer in layers) {
+ for (final ClipRectLayer layer in layers) {
layer.append(AnnotatedRegionLayer<int>(i));
containerLayer.append(layer);
i += 1;
@@ -184,7 +184,7 @@
ClipRRectLayer(clipRRect: RRect.fromLTRBR(0.0, 200.0, 100.0, 300.0, const Radius.circular(4.0))),
];
int i = 0;
- for (ClipRRectLayer layer in layers) {
+ for (final ClipRRectLayer layer in layers) {
layer.append(AnnotatedRegionLayer<int>(i));
containerLayer.append(layer);
i += 1;
@@ -209,7 +209,7 @@
OffsetLayer(offset: const Offset(0.0, 200.0)),
];
int i = 0;
- for (OffsetLayer layer in layers) {
+ for (final OffsetLayer layer in layers) {
final AnnotatedRegionLayer<int> annotatedRegionLayer = AnnotatedRegionLayer<int>(i, size: const Size(100.0, 100.0));
layer.append(annotatedRegionLayer);
transformLayer.append(layer);
@@ -231,7 +231,7 @@
AnnotatedRegionLayer<int>(index++, size: const Size(100.0, 100.0)),
AnnotatedRegionLayer<int>(index++, size: const Size(100.0, 100.0)),
];
- for (ContainerLayer layer in layers) {
+ for (final ContainerLayer layer in layers) {
final AnnotatedRegionLayer<int> annotatedRegionLayer = AnnotatedRegionLayer<int>(index++, size: const Size(100.0, 100.0));
layer.append(annotatedRegionLayer);
parent.append(layer);
diff --git a/packages/flutter/test/rendering/layer_annotations_test.dart b/packages/flutter/test/rendering/layer_annotations_test.dart
index e89da63..b3bd5d1 100644
--- a/packages/flutter/test/rendering/layer_annotations_test.dart
+++ b/packages/flutter/test/rendering/layer_annotations_test.dart
@@ -674,7 +674,7 @@
assert(!_assigned);
_assigned = true;
if (children != null) {
- for (Object child in children) {
+ for (final Object child in children) {
Layer layer;
if (child is Layer) {
layer = child;
diff --git a/packages/flutter/test/rendering/layers_test.dart b/packages/flutter/test/rendering/layers_test.dart
index e57b76b..231e15c 100644
--- a/packages/flutter/test/rendering/layers_test.dart
+++ b/packages/flutter/test/rendering/layers_test.dart
@@ -113,15 +113,15 @@
b.append(f);
c.append(g);
- for (ContainerLayer layer in allLayers) {
+ for (final ContainerLayer layer in allLayers) {
expect(layer.debugSubtreeNeedsAddToScene, true);
}
- for (ContainerLayer layer in allLayers) {
+ for (final ContainerLayer layer in allLayers) {
layer.debugMarkClean();
}
- for (ContainerLayer layer in allLayers) {
+ for (final ContainerLayer layer in allLayers) {
expect(layer.debugSubtreeNeedsAddToScene, false);
}
@@ -148,7 +148,7 @@
expect(g.debugSubtreeNeedsAddToScene, true);
a.buildScene(SceneBuilder());
- for (ContainerLayer layer in allLayers) {
+ for (final ContainerLayer layer in allLayers) {
expect(layer.debugSubtreeNeedsAddToScene, false);
}
});
diff --git a/packages/flutter/test/rendering/mock_canvas.dart b/packages/flutter/test/rendering/mock_canvas.dart
index 345187e..869db04 100644
--- a/packages/flutter/test/rendering/mock_canvas.dart
+++ b/packages/flutter/test/rendering/mock_canvas.dart
@@ -456,10 +456,10 @@
}
final Path path = object as Path;
final List<String> errors = <String>[
- for (Offset offset in includes)
+ for (final Offset offset in includes)
if (!path.contains(offset))
'Offset $offset should be inside the path, but is not.',
- for (Offset offset in excludes)
+ for (final Offset offset in excludes)
if (path.contains(offset))
'Offset $offset should be outside the path, but is not.',
];
@@ -546,7 +546,7 @@
if (!result) {
if (canvas.invocations.isNotEmpty) {
description.write('The complete display list was:');
- for (RecordedInvocation call in canvas.invocations)
+ for (final RecordedInvocation call in canvas.invocations)
description.write('\n * $call');
}
matchState[this] = '$prefixMessage\n$description';
@@ -583,7 +583,7 @@
@override
bool _evaluatePredicates(Iterable<RecordedInvocation> calls, StringBuffer description) {
int count = 0;
- for (RecordedInvocation call in calls) {
+ for (final RecordedInvocation call in calls) {
if (call.invocation.isMethod && call.invocation.memberName == _methodName) {
count++;
}
@@ -651,7 +651,7 @@
if (!result) {
if (canvas.invocations.isNotEmpty) {
description.write('The complete display list was:');
- for (RecordedInvocation call in canvas.invocations)
+ for (final RecordedInvocation call in canvas.invocations)
description.write('\n * $call');
}
matchState[this] = '$prefixMessage\n$description';
@@ -1159,13 +1159,13 @@
super.verifyArguments(arguments);
final Path pathArgument = arguments[0] as Path;
if (includes != null) {
- for (Offset offset in includes) {
+ for (final Offset offset in includes) {
if (!pathArgument.contains(offset))
throw 'It called $methodName with a path that unexpectedly did not contain $offset.';
}
}
if (excludes != null) {
- for (Offset offset in excludes) {
+ for (final Offset offset in excludes) {
if (pathArgument.contains(offset))
throw 'It called $methodName with a path that unexpectedly contained $offset.';
}
@@ -1243,13 +1243,13 @@
throw 'It called $methodName with ${arguments.length} arguments; expected 4.';
final Path pathArgument = arguments[0] as Path;
if (includes != null) {
- for (Offset offset in includes) {
+ for (final Offset offset in includes) {
if (!pathArgument.contains(offset))
throw 'It called $methodName with a path that unexpectedly did not contain $offset.';
}
}
if (excludes != null) {
- for (Offset offset in excludes) {
+ for (final Offset offset in excludes) {
if (pathArgument.contains(offset))
throw 'It called $methodName with a path that unexpectedly contained $offset.';
}
diff --git a/packages/flutter/test/rendering/slivers_helpers_test.dart b/packages/flutter/test/rendering/slivers_helpers_test.dart
index 9b30dac..5d94252 100644
--- a/packages/flutter/test/rendering/slivers_helpers_test.dart
+++ b/packages/flutter/test/rendering/slivers_helpers_test.dart
@@ -8,7 +8,7 @@
void main() {
test('applyGrowthDirectionToAxisDirection produces expected AxisDirection', () {
expect(AxisDirection.values.length, 4);
- for (AxisDirection axisDirection in AxisDirection.values) {
+ for (final AxisDirection axisDirection in AxisDirection.values) {
expect(applyGrowthDirectionToAxisDirection(axisDirection, GrowthDirection.forward), axisDirection);
}
expect(applyGrowthDirectionToAxisDirection(AxisDirection.up, GrowthDirection.reverse), AxisDirection.down);
diff --git a/packages/flutter/test/rendering/table_test.dart b/packages/flutter/test/rendering/table_test.dart
index b8ac8db..0d082e1 100644
--- a/packages/flutter/test/rendering/table_test.dart
+++ b/packages/flutter/test/rendering/table_test.dart
@@ -55,7 +55,7 @@
layout(table, constraints: const BoxConstraints.tightFor(width: 100.0));
const double expectedWidth = 100.0 / 6;
- for (RenderBox child in children) {
+ for (final RenderBox child in children) {
expect(child.size.width, moreOrLessEquals(expectedWidth));
}
});
diff --git a/packages/flutter/test/semantics/semantics_test.dart b/packages/flutter/test/semantics/semantics_test.dart
index c388482..527c336 100644
--- a/packages/flutter/test/semantics/semantics_test.dart
+++ b/packages/flutter/test/semantics/semantics_test.dart
@@ -264,7 +264,7 @@
final List<int> expectedResults = <int>[0, -1, 1, 0];
assert(tests.length == expectedResults.length);
final List<int> results = <int>[
- for (List<SemanticsSortKey> tuple in tests) tuple[0].compareTo(tuple[1]),
+ for (final List<SemanticsSortKey> tuple in tests) tuple[0].compareTo(tuple[1]),
];
expect(results, orderedEquals(expectedResults));
});
@@ -279,7 +279,7 @@
final List<int> expectedResults = <int>[0, -1, 1, 0];
assert(tests.length == expectedResults.length);
final List<int> results = <int>[
- for (List<SemanticsSortKey> tuple in tests) tuple[0].compareTo(tuple[1]),
+ for (final List<SemanticsSortKey> tuple in tests) tuple[0].compareTo(tuple[1]),
];
expect(results, orderedEquals(expectedResults));
});
diff --git a/packages/flutter/test/services/font_loader_test.dart b/packages/flutter/test/services/font_loader_test.dart
index c0242e7..029d7e7 100644
--- a/packages/flutter/test/services/font_loader_test.dart
+++ b/packages/flutter/test/services/font_loader_test.dart
@@ -29,7 +29,7 @@
Uint8List.fromList(<int>[200]),
];
- for (Uint8List asset in expectedAssets) {
+ for (final Uint8List asset in expectedAssets) {
tfl.addFont(Future<ByteData>.value(ByteData.view(asset.buffer)));
}
await tfl.load();
diff --git a/packages/flutter/test/services/raw_keyboard_test.dart b/packages/flutter/test/services/raw_keyboard_test.dart
index 6c9dce8..066ace8 100644
--- a/packages/flutter/test/services/raw_keyboard_test.dart
+++ b/packages/flutter/test/services/raw_keyboard_test.dart
@@ -15,7 +15,7 @@
void main() {
group('RawKeyboard', () {
testWidgets('keysPressed is maintained', (WidgetTester tester) async {
- for (String platform in <String>['linux', 'android', 'macos', 'fuchsia']) {
+ for (final String platform in <String>['linux', 'android', 'macos', 'fuchsia']) {
RawKeyboard.instance.clearKeysPressed();
expect(RawKeyboard.instance.keysPressed, isEmpty, reason: 'on $platform');
await simulateKeyDownEvent(LogicalKeyboardKey.shiftLeft, platform: platform);
@@ -224,7 +224,7 @@
};
test('modifier keys are recognized individually', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
final RawKeyEvent event = RawKeyEvent.fromMessage(<String, dynamic>{
'type': 'keydown',
'keymap': 'android',
@@ -237,7 +237,7 @@
'deviceId': 1,
});
final RawKeyEventDataAndroid data = event.data as RawKeyEventDataAndroid;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -256,7 +256,7 @@
}
});
test('modifier keys are recognized when combined', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
if (modifier == RawKeyEventDataAndroid.modifierFunction) {
// No need to combine function key with itself.
continue;
@@ -273,7 +273,7 @@
'deviceId': 1,
});
final RawKeyEventDataAndroid data = event.data as RawKeyEventDataAndroid;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key || key == ModifierKey.functionModifier) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -454,7 +454,7 @@
};
test('modifier keys are recognized individually', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
final RawKeyEvent event = RawKeyEvent.fromMessage(<String, dynamic>{
'type': 'keydown',
'keymap': 'fuchsia',
@@ -463,7 +463,7 @@
'modifiers': modifier,
});
final RawKeyEventDataFuchsia data = event.data as RawKeyEventDataFuchsia;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -481,7 +481,7 @@
}
});
test('modifier keys are recognized when combined', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
if (modifier == RawKeyEventDataFuchsia.modifierCapsLock) {
// No need to combine caps lock key with itself.
continue;
@@ -494,7 +494,7 @@
'modifiers': modifier | RawKeyEventDataFuchsia.modifierCapsLock,
});
final RawKeyEventDataFuchsia data = event.data as RawKeyEventDataFuchsia;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key || key == ModifierKey.capsLockModifier) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -571,7 +571,7 @@
};
test('modifier keys are recognized individually', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
final RawKeyEvent event = RawKeyEvent.fromMessage(<String, dynamic>{
'type': 'keydown',
'keymap': 'macos',
@@ -581,7 +581,7 @@
'modifiers': modifier,
});
final RawKeyEventDataMacOs data = event.data as RawKeyEventDataMacOs;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -600,7 +600,7 @@
}
});
test('modifier keys are recognized when combined', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
if (modifier == RawKeyEventDataMacOs.modifierCapsLock) {
// No need to combine caps lock key with itself.
continue;
@@ -615,7 +615,7 @@
'modifiers': modifier | RawKeyEventDataMacOs.modifierCapsLock,
});
final RawKeyEventDataMacOs data = event.data as RawKeyEventDataMacOs;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key || key == ModifierKey.capsLockModifier) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -731,9 +731,9 @@
}
test('modifier keys are recognized individually', () {
- for (int modifier in modifierTests.keys) {
- for (bool isDown in <bool>[true, false]) {
- for (bool isLeft in <bool>[true, false]) {
+ for (final int modifier in modifierTests.keys) {
+ for (final bool isDown in <bool>[true, false]) {
+ for (final bool isLeft in <bool>[true, false]) {
final RawKeyEvent event = RawKeyEvent.fromMessage(<String, dynamic>{
'type': isDown ? 'keydown' : 'keyup',
'keymap': 'linux',
@@ -745,7 +745,7 @@
'modifiers': isDown ? 0 : modifier,
});
final RawKeyEventDataLinux data = event.data as RawKeyEventDataLinux;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -766,7 +766,7 @@
}
});
test('modifier keys are recognized when combined', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
if (modifier == GLFWKeyHelper.modifierControl) {
// No need to combine CTRL key with itself.
continue;
@@ -781,7 +781,7 @@
'modifiers': modifier | GLFWKeyHelper.modifierControl,
});
final RawKeyEventDataLinux data = event.data as RawKeyEventDataLinux;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier].key == key || key == ModifierKey.controlModifier) {
expect(
data.isModifierPressed(key, side: modifierTests[modifier].side),
@@ -894,7 +894,7 @@
};
test('modifier keys are recognized individually', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
final RawKeyEvent event = RawKeyEvent.fromMessage(<String, dynamic>{
'type': 'keydown',
'keymap': 'web',
@@ -903,7 +903,7 @@
'metaState': modifier,
});
final RawKeyEventDataWeb data = event.data as RawKeyEventDataWeb;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier] == key) {
expect(
data.isModifierPressed(key),
@@ -921,7 +921,7 @@
}
});
test('modifier keys are recognized when combined', () {
- for (int modifier in modifierTests.keys) {
+ for (final int modifier in modifierTests.keys) {
if (modifier == RawKeyEventDataWeb.modifierMeta) {
// No need to combine meta key with itself.
continue;
@@ -934,7 +934,7 @@
'metaState': modifier | RawKeyEventDataWeb.modifierMeta,
});
final RawKeyEventDataWeb data = event.data as RawKeyEventDataWeb;
- for (ModifierKey key in ModifierKey.values) {
+ for (final ModifierKey key in ModifierKey.values) {
if (modifierTests[modifier] == key || key == ModifierKey.metaModifier) {
expect(
data.isModifierPressed(key),
diff --git a/packages/flutter/test/widgets/animated_switcher_test.dart b/packages/flutter/test/widgets/animated_switcher_test.dart
index b6db226..3864852 100644
--- a/packages/flutter/test/widgets/animated_switcher_test.dart
+++ b/packages/flutter/test/widgets/animated_switcher_test.dart
@@ -261,7 +261,7 @@
);
expect(find.byType(Column), findsOneWidget);
- for (Widget child in foundChildren) {
+ for (final Widget child in foundChildren) {
expect(child, isInstanceOf<KeyedSubtree>());
}
@@ -279,7 +279,7 @@
);
await tester.pump(const Duration(milliseconds: 50));
- for (Widget child in foundChildren) {
+ for (final Widget child in foundChildren) {
expect(child, isInstanceOf<KeyedSubtree>());
expect(
find.descendant(of: find.byWidget(child), matching: find.byType(SizeTransition)),
@@ -429,7 +429,7 @@
await tester.pump(const Duration(milliseconds: 10));
expect(foundChildren.length, equals(3));
- for (Widget child in foundChildren) {
+ for (final Widget child in foundChildren) {
expect(child, isInstanceOf<KeyedSubtree>());
expect(
find.descendant(of: find.byWidget(child), matching: find.byType(FadeTransition)),
@@ -459,7 +459,7 @@
await tester.pump(const Duration(milliseconds: 10));
expect(foundChildren.length, equals(3));
- for (Widget child in foundChildren) {
+ for (final Widget child in foundChildren) {
expect(child, isInstanceOf<KeyedSubtree>());
expect(
find.descendant(of: find.byWidget(child), matching: find.byType(ScaleTransition)),
diff --git a/packages/flutter/test/widgets/build_scope_test.dart b/packages/flutter/test/widgets/build_scope_test.dart
index 5ab5d2c..f17d292 100644
--- a/packages/flutter/test/widgets/build_scope_test.dart
+++ b/packages/flutter/test/widgets/build_scope_test.dart
@@ -210,12 +210,12 @@
middle = part2;
await tester.pumpWidget(part1);
- for (StatefulWrapperState state in tester.stateList<StatefulWrapperState>(find.byType(StatefulWrapper))) {
+ for (final StatefulWrapperState state in tester.stateList<StatefulWrapperState>(find.byType(StatefulWrapper))) {
expect(state.built, isNotNull);
state.oldBuilt = state.built;
state.trigger();
}
- for (StateSetter setState in setStates)
+ for (final StateSetter setState in setStates)
setState(() { });
StatefulWrapperState.buildId = 0;
@@ -223,7 +223,7 @@
didMiddle = false;
await tester.pumpWidget(part2);
- for (StatefulWrapperState state in tester.stateList<StatefulWrapperState>(find.byType(StatefulWrapper))) {
+ for (final StatefulWrapperState state in tester.stateList<StatefulWrapperState>(find.byType(StatefulWrapper))) {
expect(state.built, isNotNull);
expect(state.built, isNot(equals(state.oldBuilt)));
}
diff --git a/packages/flutter/test/widgets/custom_painter_test.dart b/packages/flutter/test/widgets/custom_painter_test.dart
index 85e2dde..abdd4ad 100644
--- a/packages/flutter/test/widgets/custom_painter_test.dart
+++ b/packages/flutter/test/widgets/custom_painter_test.dart
@@ -374,7 +374,7 @@
// Do the actions work?
final SemanticsOwner semanticsOwner = tester.binding.pipelineOwner.semanticsOwner;
int expectedLength = 1;
- for (SemanticsAction action in allActions) {
+ for (final SemanticsAction action in allActions) {
switch (action) {
case SemanticsAction.moveCursorBackwardByCharacter:
case SemanticsAction.moveCursorForwardByCharacter:
@@ -716,7 +716,7 @@
TestSemantics.rootChild(
rect: TestSemantics.fullScreen,
children: <TestSemantics>[
- for (String label in labels)
+ for (final String label in labels)
TestSemantics(
rect: const Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
label: label,
@@ -783,7 +783,7 @@
List<CustomPainterSemantics> buildSemantics(Size size) {
final List<CustomPainterSemantics> semantics = <CustomPainterSemantics>[];
- for (String label in data) {
+ for (final String label in data) {
Key key;
if (label.endsWith('-k')) {
key = ValueKey<String>(label);
diff --git a/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart b/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
index 16ec930..db35bf8 100644
--- a/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
+++ b/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
@@ -82,7 +82,7 @@
expect(tester.getRect(find.byKey(key)), const Rect.fromLTRB(0.0, 325.0, 800.0, 600.0));
});
- for (TargetPlatform platform in TargetPlatform.values) {
+ for (final TargetPlatform platform in TargetPlatform.values) {
group('$platform Scroll Physics', () {
debugDefaultTargetPlatformOverride = platform;
diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart
index 638d47f..34af7e7 100644
--- a/packages/flutter/test/widgets/editable_text_test.dart
+++ b/packages/flutter/test/widgets/editable_text_test.dart
@@ -3180,7 +3180,7 @@
platform == 'macos' ? LogicalKeyboardKey.metaLeft : LogicalKeyboardKey.altLeft,
platform: platform);
}
- for (LogicalKeyboardKey key in keys) {
+ for (final LogicalKeyboardKey key in keys) {
await tester.sendKeyEvent(key, platform: platform);
await tester.pump();
}
@@ -4039,7 +4039,7 @@
final List<String> logOrder = <String>['TextInput.setClient', 'TextInput.show', 'TextInput.setEditableSizeAndTransform', 'TextInput.setStyle', 'TextInput.setEditingState', 'TextInput.setEditingState', 'TextInput.show'];
expect(tester.testTextInput.log.length, 7);
int index = 0;
- for (MethodCall m in tester.testTextInput.log) {
+ for (final MethodCall m in tester.testTextInput.log) {
expect(m.method, logOrder[index]);
index++;
}
@@ -4083,7 +4083,7 @@
];
expect(tester.testTextInput.log.length, logOrder.length);
int index = 0;
- for (MethodCall m in tester.testTextInput.log) {
+ for (final MethodCall m in tester.testTextInput.log) {
expect(m.method, logOrder[index]);
index++;
}
@@ -4131,7 +4131,7 @@
];
expect(tester.testTextInput.log.length, logOrder.length);
int index = 0;
- for (MethodCall m in tester.testTextInput.log) {
+ for (final MethodCall m in tester.testTextInput.log) {
expect(m.method, logOrder[index]);
index++;
}
diff --git a/packages/flutter/test/widgets/fade_in_image_test.dart b/packages/flutter/test/widgets/fade_in_image_test.dart
index b2f0678..5b3b100 100644
--- a/packages/flutter/test/widgets/fade_in_image_test.dart
+++ b/packages/flutter/test/widgets/fade_in_image_test.dart
@@ -78,7 +78,7 @@
final List<FadeInImageElements> elements = <FadeInImageElements>[];
final Iterable<Element> rawImageElements = tester.elementList(find.byType(RawImage));
ComponentElement fadeInImageElement;
- for (Element rawImageElement in rawImageElements) {
+ for (final Element rawImageElement in rawImageElements) {
Element fadeTransitionElement;
rawImageElement.visitAncestorElements((Element ancestor) {
if (ancestor.widget is FadeTransition) {
diff --git a/packages/flutter/test/widgets/fitted_box_test.dart b/packages/flutter/test/widgets/fitted_box_test.dart
index 721d28c..0469a5a 100644
--- a/packages/flutter/test/widgets/fitted_box_test.dart
+++ b/packages/flutter/test/widgets/fitted_box_test.dart
@@ -407,10 +407,10 @@
testWidgets('FittedBox layers - none - clip', (WidgetTester tester) async {
final List<double> values = <double>[10.0, 50.0, 100.0];
- for (double a in values) {
- for (double b in values) {
- for (double c in values) {
- for (double d in values) {
+ for (final double a in values) {
+ for (final double b in values) {
+ for (final double c in values) {
+ for (final double d in values) {
await tester.pumpWidget(
Center(
child: SizedBox(
diff --git a/packages/flutter/test/widgets/grid_view_layout_test.dart b/packages/flutter/test/widgets/grid_view_layout_test.dart
index f3d2243..5486a9f 100644
--- a/packages/flutter/test/widgets/grid_view_layout_test.dart
+++ b/packages/flutter/test/widgets/grid_view_layout_test.dart
@@ -32,7 +32,7 @@
expect(tester.renderObjectList<RenderBox>(find.byType(DecoratedBox)), hasLength(4));
- for (RenderBox box in tester.renderObjectList<RenderBox>(find.byType(DecoratedBox))) {
+ for (final RenderBox box in tester.renderObjectList<RenderBox>(find.byType(DecoratedBox))) {
expect(box.size.width, equals(100.0), reason: 'child width');
expect(box.size.height, equals(100.0), reason: 'child height');
}
@@ -59,7 +59,7 @@
),
);
- for (RenderBox box in tester.renderObjectList<RenderBox>(find.byType(DecoratedBox))) {
+ for (final RenderBox box in tester.renderObjectList<RenderBox>(find.byType(DecoratedBox))) {
expect(box.size.width, equals(50.0), reason: 'child width');
expect(box.size.height, equals(50.0), reason: 'child height');
}
diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart
index 4a7a953..db2d5e7 100644
--- a/packages/flutter/test/widgets/image_test.dart
+++ b/packages/flutter/test/widgets/image_test.dart
@@ -1240,7 +1240,7 @@
_currentImage = imageInfo;
}
final List<ImageStreamListener> localListeners = listeners.toList();
- for (ImageStreamListener listener in localListeners) {
+ for (final ImageStreamListener listener in localListeners) {
if (imageInfo != null) {
listener.onImage(imageInfo, false);
}
diff --git a/packages/flutter/test/widgets/linked_scroll_view_test.dart b/packages/flutter/test/widgets/linked_scroll_view_test.dart
index 7517cbf..e8f4129 100644
--- a/packages/flutter/test/widgets/linked_scroll_view_test.dart
+++ b/packages/flutter/test/widgets/linked_scroll_view_test.dart
@@ -84,7 +84,7 @@
Iterable<LinkedScrollActivity> link(LinkedScrollPosition driver) sync* {
assert(hasClients);
- for (LinkedScrollPosition position in positions.cast<LinkedScrollPosition>())
+ for (final LinkedScrollPosition position in positions.cast<LinkedScrollPosition>())
yield position.link(driver);
}
@@ -129,12 +129,12 @@
if (newActivity == null)
return;
if (_beforeActivities != null) {
- for (LinkedScrollActivity activity in _beforeActivities)
+ for (final LinkedScrollActivity activity in _beforeActivities)
activity.unlink(this);
_beforeActivities.clear();
}
if (_afterActivities != null) {
- for (LinkedScrollActivity activity in _afterActivities)
+ for (final LinkedScrollActivity activity in _afterActivities)
activity.unlink(this);
_afterActivities.clear();
}
@@ -154,7 +154,7 @@
final double delta = value - minScrollExtent;
_beforeActivities ??= HashSet<LinkedScrollActivity>();
_beforeActivities.addAll(owner.linkWithBefore(this));
- for (LinkedScrollActivity activity in _beforeActivities)
+ for (final LinkedScrollActivity activity in _beforeActivities)
beforeOverscroll = math.min(activity.moveBy(delta), beforeOverscroll);
assert(beforeOverscroll <= 0.0);
}
@@ -164,7 +164,7 @@
final double delta = value - maxScrollExtent;
_afterActivities ??= HashSet<LinkedScrollActivity>();
_afterActivities.addAll(owner.linkWithAfter(this));
- for (LinkedScrollActivity activity in _afterActivities)
+ for (final LinkedScrollActivity activity in _afterActivities)
afterOverscroll = math.max(activity.moveBy(delta), afterOverscroll);
assert(afterOverscroll >= 0.0);
}
@@ -239,7 +239,7 @@
double moveBy(double delta) {
assert(drivers.isNotEmpty);
ScrollDirection commonDirection;
- for (LinkedScrollPosition driver in drivers) {
+ for (final LinkedScrollPosition driver in drivers) {
commonDirection ??= driver.userScrollDirection;
if (driver.userScrollDirection != commonDirection)
commonDirection = ScrollDirection.idle;
@@ -250,7 +250,7 @@
@override
void dispose() {
- for (LinkedScrollPosition driver in drivers)
+ for (final LinkedScrollPosition driver in drivers)
driver.unlink(this);
super.dispose();
}
diff --git a/packages/flutter/test/widgets/list_view_builder_test.dart b/packages/flutter/test/widgets/list_view_builder_test.dart
index c90aa74..8dae123 100644
--- a/packages/flutter/test/widgets/list_view_builder_test.dart
+++ b/packages/flutter/test/widgets/list_view_builder_test.dart
@@ -299,7 +299,7 @@
// ListView's height is 600, so items i0-i5 and s0-s4 fit.
await tester.pumpWidget(buildFrame(itemCount: 25));
- for (String s in <String>['i0', 's0', 'i1', 's1', 'i2', 's2', 'i3', 's3', 'i4', 's4', 'i5'])
+ for (final String s in <String>['i0', 's0', 'i1', 's1', 'i2', 's2', 'i3', 's3', 'i4', 's4', 'i5'])
expect(find.text(s), findsOneWidget);
expect(find.text('s5'), findsNothing);
expect(find.text('i6'), findsNothing);
@@ -307,10 +307,10 @@
}
void check({ List<int> visible = const <int>[], List<int> hidden = const <int>[] }) {
- for (int i in visible) {
+ for (final int i in visible) {
expect(find.text('$i'), findsOneWidget);
}
- for (int i in hidden) {
+ for (final int i in hidden) {
expect(find.text('$i'), findsNothing);
}
}
diff --git a/packages/flutter/test/widgets/multichild_test.dart b/packages/flutter/test/widgets/multichild_test.dart
index 0b0e9cd..fe6242a 100644
--- a/packages/flutter/test/widgets/multichild_test.dart
+++ b/packages/flutter/test/widgets/multichild_test.dart
@@ -17,7 +17,7 @@
final RenderStack renderObject = element.renderObject as RenderStack;
try {
RenderObject child = renderObject.firstChild;
- for (BoxDecoration decoration in expectedDecorations) {
+ for (final BoxDecoration decoration in expectedDecorations) {
expect(child is RenderDecoratedBox, isTrue);
final RenderDecoratedBox decoratedBox = child as RenderDecoratedBox;
expect(decoratedBox.decoration, equals(decoration));
diff --git a/packages/flutter/test/widgets/page_view_test.dart b/packages/flutter/test/widgets/page_view_test.dart
index 405ee45..f48c62c 100644
--- a/packages/flutter/test/widgets/page_view_test.dart
+++ b/packages/flutter/test/widgets/page_view_test.dart
@@ -663,7 +663,7 @@
await tester.pumpWidget(build());
// The first 3 items should be visible and tappable.
- for (int index in visiblePages) {
+ for (final int index in visiblePages) {
expect(find.text(index.toString()), findsOneWidget);
// The center of page 2's x-coordinate is 800, so we have to manually
// offset it a bit to make sure the tap lands within the screen.
@@ -676,7 +676,7 @@
await tester.pump();
// The last 3 items should be visible and tappable.
visiblePages = const <int> [17, 18, 19];
- for (int index in visiblePages) {
+ for (final int index in visiblePages) {
expect(find.text('$index'), findsOneWidget);
await tester.tap(find.text('$index'));
expect(tappedIndex, index);
diff --git a/packages/flutter/test/widgets/parent_data_test.dart b/packages/flutter/test/widgets/parent_data_test.dart
index f533772..4b450a4 100644
--- a/packages/flutter/test/widgets/parent_data_test.dart
+++ b/packages/flutter/test/widgets/parent_data_test.dart
@@ -26,7 +26,7 @@
final RenderStack renderObject = element.renderObject as RenderStack;
try {
RenderObject child = renderObject.firstChild;
- for (TestParentData expected in expectedParentData) {
+ for (final TestParentData expected in expectedParentData) {
expect(child is RenderDecoratedBox, isTrue);
final RenderDecoratedBox decoratedBox = child as RenderDecoratedBox;
expect(decoratedBox.parentData is StackParentData, isTrue);
diff --git a/packages/flutter/test/widgets/routes_test.dart b/packages/flutter/test/widgets/routes_test.dart
index 02b8d9c..32bde1e 100644
--- a/packages/flutter/test/widgets/routes_test.dart
+++ b/packages/flutter/test/widgets/routes_test.dart
@@ -82,7 +82,7 @@
@override
void dispose() {
log('dispose');
- for (OverlayEntry entry in _entries)
+ for (final OverlayEntry entry in _entries)
entry.remove();
_entries.clear();
routes.remove(this);
diff --git a/packages/flutter/test/widgets/scrollbar_test.dart b/packages/flutter/test/widgets/scrollbar_test.dart
index f0809b7..0ad1a7e 100644
--- a/packages/flutter/test/widgets/scrollbar_test.dart
+++ b/packages/flutter/test/widgets/scrollbar_test.dart
@@ -123,7 +123,7 @@
];
double lastCoefficient;
- for (ScrollMetrics metrics in metricsList) {
+ for (final ScrollMetrics metrics in metricsList) {
painter.update(metrics, metrics.axisDirection);
painter.paint(testCanvas, size);
@@ -154,7 +154,7 @@
const double minLen = 0;
const List<double> margins = <double> [-10, 1, viewportDimension/2 - 0.01];
- for(double margin in margins) {
+ for (final double margin in margins) {
painter = _buildPainter(
mainAxisMargin: margin,
minLength: minLen,
@@ -194,14 +194,14 @@
const Size size = Size(600, viewportDimension);
const double margin = 4;
- for(TextDirection textDirection in TextDirection.values) {
+ for (final TextDirection textDirection in TextDirection.values) {
painter = _buildPainter(
crossAxisMargin: margin,
scrollMetrics: startingMetrics,
textDirection: textDirection,
);
- for(AxisDirection direction in AxisDirection.values) {
+ for (final AxisDirection direction in AxisDirection.values) {
painter.update(
startingMetrics.copyWith(axisDirection: direction),
direction,
@@ -454,7 +454,7 @@
viewportDimension: size.height,
);
- for(double minLength in <double> [_kMinThumbExtent, double.infinity]) {
+ for (final double minLength in <double>[_kMinThumbExtent, double.infinity]) {
// Disregard `minLength` and `minOverscrollLength` to keep
// scroll direction correct, if needed
painter = _buildPainter(
@@ -471,7 +471,7 @@
Rect previousRect;
- for(ScrollMetrics metrics in metricsList) {
+ for (final ScrollMetrics metrics in metricsList) {
painter.update(metrics, metrics.axisDirection);
painter.paint(testCanvas, size);
final Rect rect = captureRect();
diff --git a/packages/flutter/test/widgets/semantics_test.dart b/packages/flutter/test/widgets/semantics_test.dart
index 8073c7b..2803695 100644
--- a/packages/flutter/test/widgets/semantics_test.dart
+++ b/packages/flutter/test/widgets/semantics_test.dart
@@ -436,7 +436,7 @@
// Do the actions work?
final SemanticsOwner semanticsOwner = tester.binding.pipelineOwner.semanticsOwner;
int expectedLength = 1;
- for (SemanticsAction action in allActions) {
+ for (final SemanticsAction action in allActions) {
switch (action) {
case SemanticsAction.moveCursorBackwardByCharacter:
case SemanticsAction.moveCursorForwardByCharacter:
diff --git a/packages/flutter/test/widgets/semantics_tester.dart b/packages/flutter/test/widgets/semantics_tester.dart
index 3a518db..dc3d2e7 100644
--- a/packages/flutter/test/widgets/semantics_tester.dart
+++ b/packages/flutter/test/widgets/semantics_tester.dart
@@ -380,7 +380,7 @@
if (thickness != null)
buf.writeln('$indent thickness: $thickness,');
buf.writeln('$indent children: <TestSemantics>[');
- for (TestSemantics child in children) {
+ for (final TestSemantics child in children) {
buf.writeln('${child.toString(indentAmount + 2)},');
}
buf.writeln('$indent ],');
diff --git a/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart b/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
index f5f599a..b94bb2d 100644
--- a/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
+++ b/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
@@ -62,7 +62,7 @@
.trim() + ',';
File findThisTestFile(Directory directory) {
- for (FileSystemEntity entity in directory.listSync()) {
+ for (final FileSystemEntity entity in directory.listSync()) {
if (entity is Directory) {
final File childSearch = findThisTestFile(entity);
if (childSearch != null) {
diff --git a/packages/flutter/test/widgets/semantics_traversal_test.dart b/packages/flutter/test/widgets/semantics_traversal_test.dart
index 9e4578b..b7ee4d0 100644
--- a/packages/flutter/test/widgets/semantics_traversal_test.dart
+++ b/packages/flutter/test/widgets/semantics_traversal_test.dart
@@ -66,7 +66,7 @@
// │ B │
// └───┘
testTraversal('Semantics traverses vertically top-to-bottom', (TraversalTester tester) async {
- for (TextDirection textDirection in TextDirection.values) {
+ for (final TextDirection textDirection in TextDirection.values) {
await tester.test(
textDirection: textDirection,
children: <String, Rect>{
diff --git a/packages/flutter/test/widgets/shadow_test.dart b/packages/flutter/test/widgets/shadow_test.dart
index f95f753..95a1ca9 100644
--- a/packages/flutter/test/widgets/shadow_test.dart
+++ b/packages/flutter/test/widgets/shadow_test.dart
@@ -56,7 +56,7 @@
),
);
}
- for (int elevation in kElevationToShadow.keys) {
+ for (final int elevation in kElevationToShadow.keys) {
await tester.pumpWidget(build(elevation));
await expectLater(
find.byType(Container),
@@ -120,7 +120,7 @@
),
);
}
- for (int elevation in kElevationToShadow.keys) {
+ for (final int elevation in kElevationToShadow.keys) {
await tester.pumpWidget(build(elevation.toDouble()));
await expectLater(
find.byType(Container),
diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart
index 638757d..70c18dc 100644
--- a/packages/flutter/test/widgets/widget_inspector_test.dart
+++ b/packages/flutter/test/widgets/widget_inspector_test.dart
@@ -1260,7 +1260,7 @@
final List<Object> propertiesJson = childJson['properties'] as List<Object>;
final DiagnosticsNode diagnosticsNode = service.toObject(childJson['objectId'] as String) as DiagnosticsNode;
final List<DiagnosticsNode> expectedProperties = diagnosticsNode.getProperties();
- for (Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
+ for (final Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
final Object property = service.toObject(propertyJson['objectId'] as String);
expect(property, isInstanceOf<DiagnosticsNode>());
expect(expectedProperties, contains(property));
@@ -1296,12 +1296,12 @@
expect(service.toObject(childJson['valueId'] as String), equals(children[i].value));
expect(service.toObject(childJson['objectId'] as String), isInstanceOf<DiagnosticsNode>());
final List<Object> propertiesJson = childJson['properties'] as List<Object>;
- for (Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
+ for (final Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
expect(propertyJson, isNot(contains('children')));
}
final DiagnosticsNode diagnosticsNode = service.toObject(childJson['objectId'] as String) as DiagnosticsNode;
final List<DiagnosticsNode> expectedProperties = diagnosticsNode.getProperties();
- for (Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
+ for (final Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
final Object property = service.toObject(propertyJson['objectId'] as String);
expect(property, isInstanceOf<DiagnosticsNode>());
expect(expectedProperties, contains(property));
@@ -1313,9 +1313,9 @@
<String, String>{'arg': id, 'objectGroup': group, 'subtreeDepth': '3'},
) as Map<String, Object>;
final List<Object> deepChildrenJson = deepSubtreeJson['children'] as List<Object>;
- for(Map<String, Object> childJson in deepChildrenJson.cast<Map<String, Object>>()) {
+ for (final Map<String, Object> childJson in deepChildrenJson.cast<Map<String, Object>>()) {
final List<Object> propertiesJson = childJson['properties'] as List<Object>;
- for (Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
+ for (final Map<String, Object> propertyJson in propertiesJson.cast<Map<String, Object>>()) {
expect(propertyJson, contains('children'));
}
}
@@ -2584,7 +2584,7 @@
final List<Map<String, Object>> appBars = <Map<String, Object>>[];
void visitChildren(List<dynamic> children) {
- for (Map<String, Object> child in children.cast<Map<String, Object>>()) {
+ for (final Map<String, Object> child in children.cast<Map<String, Object>>()) {
if (child['description'] == 'AppBar') {
appBars.add(child);
}
diff --git a/packages/flutter_driver/lib/src/common/wait.dart b/packages/flutter_driver/lib/src/common/wait.dart
index d5ba23d..b8f5f0e 100644
--- a/packages/flutter_driver/lib/src/common/wait.dart
+++ b/packages/flutter_driver/lib/src/common/wait.dart
@@ -251,7 +251,7 @@
}
final List<SerializableWaitCondition> conditions = <SerializableWaitCondition>[];
- for (Map<String, dynamic> condition in json.decode(jsonMap['conditions'])) {
+ for (final Map<String, dynamic> condition in json.decode(jsonMap['conditions'])) {
conditions.add(_deserialize(condition.cast<String, String>()));
}
return CombinedCondition(conditions);
diff --git a/packages/flutter_driver/lib/src/driver/vmservice_driver.dart b/packages/flutter_driver/lib/src/driver/vmservice_driver.dart
index 8db6af8..2a421a0 100644
--- a/packages/flutter_driver/lib/src/driver/vmservice_driver.dart
+++ b/packages/flutter_driver/lib/src/driver/vmservice_driver.dart
@@ -416,7 +416,7 @@
Future<bool> _isPrecompiledMode() async {
final List<Map<String, dynamic>> flags = await getVmFlags();
- for(Map<String, dynamic> flag in flags) {
+ for(final Map<String, dynamic> flag in flags) {
if (flag['name'] == 'precompiled_mode') {
return flag['valueAsString'] == 'true';
}
diff --git a/packages/flutter_driver/lib/src/driver/web_driver.dart b/packages/flutter_driver/lib/src/driver/web_driver.dart
index 9059ecf..ba772a3 100644
--- a/packages/flutter_driver/lib/src/driver/web_driver.dart
+++ b/packages/flutter_driver/lib/src/driver/web_driver.dart
@@ -123,7 +123,7 @@
_checkBrowserSupportsTimeline();
final List<Map<String, dynamic>> events = <Map<String, dynamic>>[];
- for (sync_io.LogEntry entry in _connection.logs) {
+ for (final sync_io.LogEntry entry in _connection.logs) {
if (_startTime.isBefore(entry.timestamp)) {
final Map<String, dynamic> data = jsonDecode(entry.message)['message'] as Map<String, dynamic>;
if (data['method'] == 'Tracing.dataCollected') {
diff --git a/packages/flutter_driver/lib/src/extension/wait_conditions.dart b/packages/flutter_driver/lib/src/extension/wait_conditions.dart
index 336d48c..fa7dac0 100644
--- a/packages/flutter_driver/lib/src/extension/wait_conditions.dart
+++ b/packages/flutter_driver/lib/src/extension/wait_conditions.dart
@@ -185,7 +185,7 @@
@override
Future<void> wait() async {
while (!condition) {
- for (WaitCondition condition in conditions) {
+ for (final WaitCondition condition in conditions) {
assert (condition != null);
await condition.wait();
}
diff --git a/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart b/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart
index 77c4950..6e2c00f 100644
--- a/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart
+++ b/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart
@@ -47,7 +47,7 @@
List<Map<String, dynamic>> rasterizeTimeSequenceInMillis(List<int> sequence) {
final List<Map<String, dynamic>> result = <Map<String, dynamic>>[];
int t = 0;
- for (int duration in sequence) {
+ for (final int duration in sequence) {
result.add(begin(t));
t += duration * 1000;
result.add(end(t));
diff --git a/packages/flutter_goldens/lib/flutter_goldens.dart b/packages/flutter_goldens/lib/flutter_goldens.dart
index 574ed7d..6ffe4a7 100644
--- a/packages/flutter_goldens/lib/flutter_goldens.dart
+++ b/packages/flutter_goldens/lib/flutter_goldens.dart
@@ -506,7 +506,7 @@
ComparisonResult result;
final Map<String, ComparisonResult> failureDiffs = <String, ComparisonResult>{};
- for (String expectation in testExpectations) {
+ for (final String expectation in testExpectations) {
final List<int> goldenBytes = await skiaClient.getImageBytes(expectation);
result = GoldenFileComparator.compareLists(
@@ -520,7 +520,7 @@
failureDiffs[expectation] = result;
}
- for (MapEntry<String, ComparisonResult> entry in failureDiffs.entries) {
+ for (final MapEntry<String, ComparisonResult> entry in failureDiffs.entries) {
if (await skiaClient.isValidDigestForExpectation(entry.key, golden.path))
generateFailureOutput(entry.value, golden, basedir, key: entry.key);
}
diff --git a/packages/flutter_localizations/test/cupertino/translations_test.dart b/packages/flutter_localizations/test/cupertino/translations_test.dart
index 81c1827..d13974e 100644
--- a/packages/flutter_localizations/test/cupertino/translations_test.dart
+++ b/packages/flutter_localizations/test/cupertino/translations_test.dart
@@ -7,7 +7,7 @@
import 'package:flutter_test/flutter_test.dart';
void main() {
- for (String language in kCupertinoSupportedLanguages) {
+ for (final String language in kCupertinoSupportedLanguages) {
testWidgets('translations exist for $language', (WidgetTester tester) async {
final Locale locale = Locale(language);
diff --git a/packages/flutter_localizations/test/material/date_picker_test.dart b/packages/flutter_localizations/test/material/date_picker_test.dart
index 99d8074..3563f17 100644
--- a/packages/flutter_localizations/test/material/date_picker_test.dart
+++ b/packages/flutter_localizations/test/material/date_picker_test.dart
@@ -51,7 +51,7 @@
},
};
- for (Locale locale in testLocales.keys) {
+ for (final Locale locale in testLocales.keys) {
testWidgets('shows dates for $locale', (WidgetTester tester) async {
final List<String> expectedDaysOfWeek = testLocales[locale]['expectedDaysOfWeek'] as List<String>;
final List<String> expectedDaysOfMonth = testLocales[locale]['expectedDaysOfMonth'] as List<String>;
@@ -70,12 +70,12 @@
expect(find.text(expectedMonthYearHeader), findsOneWidget);
- for (String dayOfWeek in expectedDaysOfWeek) {
+ for (final String dayOfWeek in expectedDaysOfWeek) {
expect(find.text(dayOfWeek), findsWidgets);
}
Offset previousCellOffset;
- for (String dayOfMonth in expectedDaysOfMonth) {
+ for (final String dayOfMonth in expectedDaysOfMonth) {
final Finder dayCell = find.descendant(of: find.byType(GridView), matching: find.text(dayOfMonth));
expect(dayCell, findsOneWidget);
diff --git a/packages/flutter_localizations/test/material/time_picker_test.dart b/packages/flutter_localizations/test/material/time_picker_test.dart
index a4bbc7d..597e241 100644
--- a/packages/flutter_localizations/test/material/time_picker_test.dart
+++ b/packages/flutter_localizations/test/material/time_picker_test.dart
@@ -68,7 +68,7 @@
const Locale('zh', 'ZH'): const <String>['period', 'hour', 'string :', 'minute'], //'ah:mm'
};
- for (Locale locale in locales.keys) {
+ for (final Locale locale in locales.keys) {
final Offset center = await startPicker(tester, (TimeOfDay time) { }, locale: locale);
final List<String> actual = <String>[];
tester.element(find.byType(CustomMultiChildLayout)).visitChildren((Element child) {
@@ -114,7 +114,7 @@
Locale('en', 'GB'), // HH
Locale('es', 'ES'), // H
];
- for (Locale locale in locales) {
+ for (final Locale locale in locales) {
// Tap along the segment stretching from the center to the edge at
// 12:00 AM position. There are two rings. At ~70% mark, the ring
// switches between inner ring and outer ring.
diff --git a/packages/flutter_localizations/test/material/translations_test.dart b/packages/flutter_localizations/test/material/translations_test.dart
index 782131b..fa2c946 100644
--- a/packages/flutter_localizations/test/material/translations_test.dart
+++ b/packages/flutter_localizations/test/material/translations_test.dart
@@ -7,7 +7,7 @@
import 'package:flutter_test/flutter_test.dart';
void main() {
- for (String language in kMaterialSupportedLanguages) {
+ for (final String language in kMaterialSupportedLanguages) {
testWidgets('translations exist for $language', (WidgetTester tester) async {
final Locale locale = Locale(language);
diff --git a/packages/flutter_test/lib/src/accessibility.dart b/packages/flutter_test/lib/src/accessibility.dart
index 12c617c..2af0d54 100644
--- a/packages/flutter_test/lib/src/accessibility.dart
+++ b/packages/flutter_test/lib/src/accessibility.dart
@@ -215,7 +215,7 @@
children.add(child);
return true;
});
- for (SemanticsNode child in children) {
+ for (final SemanticsNode child in children) {
result += await evaluateNode(child);
}
if (_shouldSkipNode(data)) {
@@ -348,7 +348,7 @@
class _ContrastReport {
factory _ContrastReport(List<int> colors) {
final Map<int, int> colorHistogram = <int, int>{};
- for (int color in colors) {
+ for (final int color in colors) {
colorHistogram[color] = (colorHistogram[color] ?? 0) + 1;
}
if (colorHistogram.length == 1) {
@@ -358,7 +358,7 @@
// to determine the lighter and darker color, partition the colors
// by lightness and then choose the mode from each group.
double averageLightness = 0.0;
- for (int color in colorHistogram.keys) {
+ for (final int color in colorHistogram.keys) {
final HSLColor hslColor = HSLColor.fromColor(Color(color));
averageLightness += hslColor.lightness * colorHistogram[color];
}
@@ -369,7 +369,7 @@
int lightCount = 0;
int darkCount = 0;
// Find the most frequently occurring light and dark color.
- for (MapEntry<int, int> entry in colorHistogram.entries) {
+ for (final MapEntry<int, int> entry in colorHistogram.entries) {
final HSLColor color = HSLColor.fromColor(Color(entry.key));
final int count = entry.value;
if (color.lightness <= averageLightness && count > darkCount) {
diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart
index 32c91c0..fbdfab5 100644
--- a/packages/flutter_test/lib/src/binding.dart
+++ b/packages/flutter_test/lib/src/binding.dart
@@ -1119,7 +1119,7 @@
}
debugPrint('Pending timers:');
- for (String timerInfo in _currentFakeAsync.pendingTimersDebugInfo) {
+ for (final String timerInfo in _currentFakeAsync.pendingTimersDebugInfo) {
final int firstLineEnd = timerInfo.indexOf('\n');
assert(firstLineEnd != -1);
@@ -1657,7 +1657,7 @@
..strokeWidth = radius / 10.0
..style = PaintingStyle.stroke;
bool dirty = false;
- for (int pointer in _pointers.keys) {
+ for (final int pointer in _pointers.keys) {
final _LiveTestPointerRecord record = _pointers[pointer];
paint.color = record.color.withOpacity(record.decay < 0 ? (record.decay / (_kPointerDecay - 1)) : 1.0);
canvas.drawPath(path.shift(record.position), paint);
diff --git a/packages/flutter_test/lib/src/event_simulation.dart b/packages/flutter_test/lib/src/event_simulation.dart
index 63b62f4..11cdaea 100644
--- a/packages/flutter_test/lib/src/event_simulation.dart
+++ b/packages/flutter_test/lib/src/event_simulation.dart
@@ -57,7 +57,7 @@
map = kLinuxToPhysicalKey;
break;
}
- for (int code in map.keys) {
+ for (final int code in map.keys) {
if (key.debugName == map[code].debugName) {
scanCode = code;
break;
@@ -84,7 +84,7 @@
map = kGlfwToLogicalKey;
break;
}
- for (int code in map.keys) {
+ for (final int code in map.keys) {
if (key.debugName == map[code].debugName) {
keyCode = code;
break;
diff --git a/packages/flutter_test/lib/src/finders.dart b/packages/flutter_test/lib/src/finders.dart
index d6d8de6..a95c3af 100644
--- a/packages/flutter_test/lib/src/finders.dart
+++ b/packages/flutter_test/lib/src/finders.dart
@@ -719,7 +719,7 @@
@override
Iterable<Element> get allCandidates {
final List<Element> candidates = <Element>[];
- for (Element root in descendant.evaluate()) {
+ for (final Element root in descendant.evaluate()) {
final List<Element> ancestors = <Element>[];
if (matchRoot)
ancestors.add(root);
diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart
index 866e3d0..529774b 100644
--- a/packages/flutter_test/lib/src/matchers.dart
+++ b/packages/flutter_test/lib/src/matchers.dart
@@ -1184,7 +1184,7 @@
bool _deepEqualsMap(Map<dynamic, dynamic> a, Map<dynamic, dynamic> b) {
if (a.length != b.length)
return false;
- for (dynamic key in a.keys) {
+ for (final dynamic key in a.keys) {
if (!b.containsKey(key) || !_deepEquals(a[key], b[key]))
return false;
}
@@ -1782,7 +1782,7 @@
description.add(' with custom hints: $hintOverrides');
if (children != null) {
description.add(' with children:\n');
- for (_MatchesSemanticsData child in children.cast<_MatchesSemanticsData>())
+ for (final _MatchesSemanticsData child in children.cast<_MatchesSemanticsData>())
child.describe(description);
}
return description;
@@ -1824,11 +1824,11 @@
return failWithDescription(matchState, 'maxValueLength was: ${data.maxValueLength}');
if (actions != null) {
int actionBits = 0;
- for (SemanticsAction action in actions)
+ for (final SemanticsAction action in actions)
actionBits |= action.index;
if (actionBits != data.actions) {
final List<String> actionSummary = <String>[
- for (SemanticsAction action in SemanticsAction.values.values)
+ for (final SemanticsAction action in SemanticsAction.values.values)
if ((data.actions & action.index) != 0)
describeEnum(action),
];
@@ -1858,11 +1858,11 @@
}
if (flags != null) {
int flagBits = 0;
- for (SemanticsFlag flag in flags)
+ for (final SemanticsFlag flag in flags)
flagBits |= flag.index;
if (flagBits != data.flags) {
final List<String> flagSummary = <String>[
- for (SemanticsFlag flag in SemanticsFlag.values.values)
+ for (final SemanticsFlag flag in SemanticsFlag.values.values)
if ((data.flags & flag.index) != 0)
describeEnum(flag),
];
diff --git a/packages/flutter_test/lib/src/test_async_utils.dart b/packages/flutter_test/lib/src/test_async_utils.dart
index 9c50733..9f8100e 100644
--- a/packages/flutter_test/lib/src/test_async_utils.dart
+++ b/packages/flutter_test/lib/src/test_async_utils.dart
@@ -274,7 +274,7 @@
ErrorSummary('Asynchronous call to guarded function leaked.'),
ErrorHint('You must use "await" with all Future-returning test APIs.')
];
- for (_AsyncScope scope in _scopeStack) {
+ for (final _AsyncScope scope in _scopeStack) {
final _StackEntry guarder = _findResponsibleMethod(scope.creationStack, 'guard', information);
if (guarder != null) {
information.add(ErrorDescription(
diff --git a/packages/flutter_test/lib/src/test_compat.dart b/packages/flutter_test/lib/src/test_compat.dart
index c4f5496..f157a37 100644
--- a/packages/flutter_test/lib/src/test_compat.dart
+++ b/packages/flutter_test/lib/src/test_compat.dart
@@ -54,7 +54,7 @@
setUpAllSucceeded = liveTest.state.result.isPassing;
}
if (setUpAllSucceeded) {
- for (GroupEntry entry in group.entries) {
+ for (final GroupEntry entry in group.entries) {
if (entry is Group) {
await _runGroup(suiteConfig, entry, parents, reporter);
} else if (entry.metadata.skip) {
@@ -502,7 +502,7 @@
}
final StringBuffer buffer = StringBuffer('$first${lines.first}\n');
// Write out all but the first and last lines with [prefix].
- for (String line in lines.skip(1).take(lines.length - 2)) {
+ for (final String line in lines.skip(1).take(lines.length - 2)) {
buffer.writeln('$prefix$line');
}
buffer.write('$last${lines.last}');
diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart
index 49760cf..afac83b 100644
--- a/packages/flutter_test/lib/src/widget_tester.dart
+++ b/packages/flutter_test/lib/src/widget_tester.dart
@@ -117,7 +117,7 @@
assert(variant.values.isNotEmpty, 'There must be at least on value to test in the testing variant');
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as TestWidgetsFlutterBinding;
final WidgetTester tester = WidgetTester._(binding);
- for (dynamic value in variant.values) {
+ for (final dynamic value in variant.values) {
final String variationDescription = variant.describeValue(value);
final String combinedDescription = variationDescription.isNotEmpty ? '$description ($variationDescription)' : description;
test(
@@ -629,7 +629,7 @@
int numberOfTypes = 0;
int totalNumber = 0;
debugPrint('Some possible finders for the widgets at ${binding.globalToLocal(event.position)}:');
- for (Element element in candidates) {
+ for (final Element element in candidates) {
if (totalNumber > 13) // an arbitrary number of finders that feels useful without being overwhelming
break;
totalNumber += 1; // optimistically assume we'll be able to describe it
@@ -755,7 +755,7 @@
void verifyTickersWereDisposed([ String when = 'when none should have been' ]) {
assert(when != null);
if (_tickers != null) {
- for (Ticker ticker in _tickers) {
+ for (final Ticker ticker in _tickers) {
if (ticker.isActive) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('A Ticker was active $when.'),
diff --git a/packages/flutter_test/test/event_simulation_test.dart b/packages/flutter_test/test/event_simulation_test.dart
index f4d74ad..91fefce 100644
--- a/packages/flutter_test/test/event_simulation_test.dart
+++ b/packages/flutter_test/test/event_simulation_test.dart
@@ -25,7 +25,7 @@
focusNode.requestFocus();
await tester.idle();
- for (String platform in platforms) {
+ for (final String platform in platforms) {
await tester.sendKeyEvent(LogicalKeyboardKey.shiftLeft, platform: platform);
await tester.sendKeyEvent(LogicalKeyboardKey.shift, platform: platform);
await tester.sendKeyDownEvent(LogicalKeyboardKey.keyA, platform: platform);
diff --git a/packages/flutter_test/test/matchers_test.dart b/packages/flutter_test/test/matchers_test.dart
index ecd0f18..79af061 100644
--- a/packages/flutter_test/test/matchers_test.dart
+++ b/packages/flutter_test/test/matchers_test.dart
@@ -530,9 +530,9 @@
int actions = 0;
int flags = 0;
const CustomSemanticsAction action = CustomSemanticsAction(label: 'test');
- for (int index in SemanticsAction.values.keys)
+ for (final int index in SemanticsAction.values.keys)
actions |= index;
- for (int index in SemanticsFlag.values.keys)
+ for (final int index in SemanticsFlag.values.keys)
// TODO(mdebbar): Remove this if after https://github.com/flutter/engine/pull/9894
if (SemanticsFlag.values[index] != SemanticsFlag.isMultiline)
flags |= index;
diff --git a/packages/flutter_test/test/test_config/config_test_utils.dart b/packages/flutter_test/test/test_config/config_test_utils.dart
index 31d2c3e..a7397a8 100644
--- a/packages/flutter_test/test/test_config/config_test_utils.dart
+++ b/packages/flutter_test/test/test_config/config_test_utils.dart
@@ -20,7 +20,7 @@
test(description, () {
expect(actualStringValue, expectedStringValue);
- for (Type key in otherExpectedValues.keys) {
+ for (final Type key in otherExpectedValues.keys) {
expect(otherActualValues[key], otherExpectedValues[key]);
}
});
diff --git a/packages/flutter_tools/bin/fuchsia_asset_builder.dart b/packages/flutter_tools/bin/fuchsia_asset_builder.dart
index 5e980aa..dd75c65 100644
--- a/packages/flutter_tools/bin/fuchsia_asset_builder.dart
+++ b/packages/flutter_tools/bin/fuchsia_asset_builder.dart
@@ -86,7 +86,7 @@
await destFile.create(recursive: true);
final libfs.IOSink outFile = destFile.openWrite();
- for (String path in assets.entries.keys) {
+ for (final String path in assets.entries.keys) {
outFile.write('data/$componentName/$path=$outputBase/$path\n');
}
await outFile.flush();
diff --git a/packages/flutter_tools/bin/fuchsia_tester.dart b/packages/flutter_tools/bin/fuchsia_tester.dart
index b23d980..0e60a96 100644
--- a/packages/flutter_tools/bin/fuchsia_tester.dart
+++ b/packages/flutter_tools/bin/fuchsia_tester.dart
@@ -105,7 +105,7 @@
final Directory sdkRootDest =
globals.fs.directory(globals.artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath));
sdkRootDest.createSync(recursive: true);
- for (FileSystemEntity artifact in sdkRootSrc.listSync()) {
+ for (final FileSystemEntity artifact in sdkRootSrc.listSync()) {
globals.fs.link(sdkRootDest.childFile(artifact.basename).path).createSync(artifact.path);
}
// TODO(tvolkert): Remove once flutter_tester no longer looks for this.
@@ -136,7 +136,7 @@
final Map<String, String> tests = <String, String>{};
final List<Map<String, dynamic>> jsonList = List<Map<String, dynamic>>.from(
(json.decode(globals.fs.file(argResults[_kOptionTests]).readAsStringSync()) as List<dynamic>).cast<Map<String, dynamic>>());
- for (Map<String, dynamic> map in jsonList) {
+ for (final Map<String, dynamic> map in jsonList) {
final String source = globals.fs.file(map['source']).resolveSymbolicLinksSync();
final String dill = globals.fs.file(map['dill']).resolveSymbolicLinksSync();
tests[source] = dill;
diff --git a/packages/flutter_tools/lib/src/android/android_builder.dart b/packages/flutter_tools/lib/src/android/android_builder.dart
index 17b5d5d..40ddbd6 100644
--- a/packages/flutter_tools/lib/src/android/android_builder.dart
+++ b/packages/flutter_tools/lib/src/android/android_builder.dart
@@ -68,7 +68,7 @@
// Module projects artifacts are located in `build/host`.
outputDirectory = outputDirectory.childDirectory('host');
}
- for (AndroidBuildInfo androidBuildInfo in androidBuildInfo) {
+ for (final AndroidBuildInfo androidBuildInfo in androidBuildInfo) {
await buildGradleAar(
project: project,
androidBuildInfo: androidBuildInfo,
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index 3b8d6b5..384e3b0 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -732,7 +732,7 @@
Map<String, String> parseAdbDeviceProperties(String str) {
final Map<String, String> properties = <String, String>{};
final RegExp propertyExp = RegExp(r'\[(.*?)\]: \[(.*?)\]');
- for (Match match in propertyExp.allMatches(str)) {
+ for (final Match match in propertyExp.allMatches(str)) {
properties[match.group(1)] = match.group(2);
}
return properties;
@@ -932,7 +932,7 @@
return;
}
- for (String line in text.trim().split('\n')) {
+ for (final String line in text.trim().split('\n')) {
// Skip lines like: * daemon started successfully *
if (line.startsWith('* daemon ')) {
continue;
@@ -958,7 +958,7 @@
final Map<String, String> info = <String, String>{};
if (rest != null && rest.isNotEmpty) {
rest = rest.trim();
- for (String data in rest.split(' ')) {
+ for (final String data in rest.split(' ')) {
if (data.contains(':')) {
final List<String> fields = data.split(':');
info[fields[0]] = fields[1];
@@ -1165,7 +1165,7 @@
}
final List<String> lines = LineSplitter.split(stdout).toList();
- for (String line in lines) {
+ for (final String line in lines) {
if (!line.startsWith(device.id)) {
continue;
}
@@ -1260,7 +1260,7 @@
@override
Future<void> dispose() async {
- for (ForwardedPort port in forwardedPorts) {
+ for (final ForwardedPort port in forwardedPorts) {
await unforward(port);
}
}
diff --git a/packages/flutter_tools/lib/src/android/android_emulator.dart b/packages/flutter_tools/lib/src/android/android_emulator.dart
index 5a7a04e..b7c0557 100644
--- a/packages/flutter_tools/lib/src/android/android_emulator.dart
+++ b/packages/flutter_tools/lib/src/android/android_emulator.dart
@@ -85,7 +85,7 @@
/// Parse the given `emulator -list-avds` output in [text], and fill out the given list
/// of emulators by reading information from the relevant ini files.
void extractEmulatorAvdInfo(String text, List<AndroidEmulator> emulators) {
- for (String id in text.trim().split('\n').where((String l) => l != '')) {
+ for (final String id in text.trim().split('\n').where((String l) => l != '')) {
emulators.add(_loadEmulatorInfo(id));
}
}
@@ -125,7 +125,7 @@
// Split into name/value
.map<List<String>>((String l) => l.split('='));
- for (List<String> property in properties) {
+ for (final List<String> property in properties) {
results[property[0].trim()] = property[1].trim();
}
diff --git a/packages/flutter_tools/lib/src/android/android_sdk.dart b/packages/flutter_tools/lib/src/android/android_sdk.dart
index 7c4ab74..50fc605 100644
--- a/packages/flutter_tools/lib/src/android/android_sdk.dart
+++ b/packages/flutter_tools/lib/src/android/android_sdk.dart
@@ -215,7 +215,7 @@
.map<String>((String line) => line.trim())
.where((String line) => line.isNotEmpty);
final Map<String, String> properties = <String, String>{};
- for (String line in propertiesFileLines) {
+ for (final String line in propertiesFileLines) {
final List<String> parts = line.split(' = ');
if (parts.length == 2) {
properties[parts[0]] = parts[1];
diff --git a/packages/flutter_tools/lib/src/android/android_studio.dart b/packages/flutter_tools/lib/src/android/android_studio.dart
index 32014e2..f7ebfb4 100644
--- a/packages/flutter_tools/lib/src/android/android_studio.dart
+++ b/packages/flutter_tools/lib/src/android/android_studio.dart
@@ -183,7 +183,7 @@
.directory(path)
.listSync(followLinks: false)
.whereType<Directory>();
- for (Directory directory in directories) {
+ for (final Directory directory in directories) {
final String name = directory.basename;
// An exact match, or something like 'Android Studio 3.0 Preview.app'.
if (name.startsWith('Android Studio') && name.endsWith('.app')) {
@@ -236,7 +236,7 @@
// Read all $HOME/.AndroidStudio*/system/.home files. There may be several
// pointing to the same installation, so we grab only the latest one.
if (homeDirPath != null && globals.fs.directory(homeDirPath).existsSync()) {
- for (FileSystemEntity entity in globals.fs.directory(homeDirPath).listSync(followLinks: false)) {
+ for (final FileSystemEntity entity in globals.fs.directory(homeDirPath).listSync(followLinks: false)) {
if (entity is Directory && entity.basename.startsWith('.AndroidStudio')) {
final AndroidStudio studio = AndroidStudio.fromHomeDot(entity);
if (studio != null && !_hasStudioAt(studio.directory, newerThan: studio.version)) {
diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart
index 676599a..82364a1 100644
--- a/packages/flutter_tools/lib/src/android/gradle.dart
+++ b/packages/flutter_tools/lib/src/android/gradle.dart
@@ -116,7 +116,7 @@
if (!appGradle.existsSync()) {
return false;
}
- for (String line in appGradle.readAsLinesSync()) {
+ for (final String line in appGradle.readAsLinesSync()) {
if (line.contains(RegExp(r'apply from: .*/flutter.gradle')) ||
line.contains("def flutterPluginVersion = 'managed'")) {
return true;
@@ -184,7 +184,7 @@
existingVariants.add(settingsAarContent);
bool exactMatch = false;
- for (String fileContentVariant in existingVariants) {
+ for (final String fileContentVariant in existingVariants) {
if (currentFileContent.trim() == fileContentVariant.trim()) {
exactMatch = true;
break;
@@ -465,7 +465,7 @@
final File apkShaFile = apkDirectory.childFile('app.apk.sha1');
apkShaFile.writeAsStringSync(_calculateSha(apkFiles.first));
- for (File apkFile in apkFiles) {
+ for (final File apkFile in apkFiles) {
final String appSize = (buildInfo.mode == BuildMode.debug)
? '' // Don't display the size when building a debug variant.
: ' (${getSizeAsMB(apkFile.lengthSync())})';
@@ -618,7 +618,7 @@
dependencies {''');
- for (String buildMode in buildModes) {
+ for (final String buildMode in buildModes) {
globals.printStatus('''
${buildMode}Implementation '$androidPackage:flutter_$buildMode:$buildNumber''');
}
@@ -647,7 +647,7 @@
String _hex(List<int> bytes) {
final StringBuffer result = StringBuffer();
- for (int part in bytes) {
+ for (final int part in bytes) {
result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
}
return result.toString();
@@ -707,7 +707,7 @@
return;
}
final List<String> plugins = flutterPluginFile.readAsStringSync().split('\n');
- for (String plugin in plugins) {
+ for (final String plugin in plugins) {
final List<String> pluginParts = plugin.split('=');
if (pluginParts.length != 2) {
continue;
@@ -882,7 +882,7 @@
}
final Iterable<xml.XmlElement> project = document.findElements('project');
assert(project.isNotEmpty);
- for (xml.XmlElement versionElement in document.findAllElements('version')) {
+ for (final xml.XmlElement versionElement in document.findAllElements('version')) {
if (versionElement.parent == project.first) {
return versionElement.text;
}
@@ -919,7 +919,7 @@
'flutter_embedding_$buildMode.pom',
)
);
- for (String artifact in const <String>['pom', 'jar']) {
+ for (final String artifact in const <String>['pom', 'jar']) {
// The Android embedding artifacts.
_createSymlink(
globals.fs.path.join(
diff --git a/packages/flutter_tools/lib/src/android/gradle_errors.dart b/packages/flutter_tools/lib/src/android/gradle_errors.dart
index be2c00a..9d5e63b 100644
--- a/packages/flutter_tools/lib/src/android/gradle_errors.dart
+++ b/packages/flutter_tools/lib/src/android/gradle_errors.dart
@@ -283,7 +283,7 @@
);
// Extract build types and product flavors.
final Set<String> variants = <String>{};
- for (String task in tasksRunResult.stdout.split('\n')) {
+ for (final String task in tasksRunResult.stdout.split('\n')) {
final Match match = _assembleTaskPattern.matchAsPrefix(task);
if (match != null) {
final String variant = match.group(1).toLowerCase();
diff --git a/packages/flutter_tools/lib/src/aot.dart b/packages/flutter_tools/lib/src/aot.dart
index bbf4c0e..976eb09 100644
--- a/packages/flutter_tools/lib/src/aot.dart
+++ b/packages/flutter_tools/lib/src/aot.dart
@@ -89,7 +89,7 @@
if (platform == TargetPlatform.ios) {
// Determine which iOS architectures to build for.
final Map<DarwinArch, String> iosBuilds = <DarwinArch, String>{};
- for (DarwinArch arch in iosBuildArchs) {
+ for (final DarwinArch arch in iosBuildArchs) {
iosBuilds[arch] = globals.fs.path.join(outputPath, getNameForDarwinArch(arch));
}
@@ -224,7 +224,7 @@
));
status?.stop();
if (!result.success) {
- for (ExceptionMeasurement measurement in result.exceptions.values) {
+ for (final ExceptionMeasurement measurement in result.exceptions.values) {
globals.printError('Target ${measurement.target} failed: ${measurement.exception}',
stackTrace: measurement.fatal
? measurement.stackTrace
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index 27625a3..034f02d 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -213,16 +213,16 @@
final String packageId = manifests.first.getAttribute('package');
String launchActivity;
- for (xml.XmlElement activity in document.findAllElements('activity')) {
+ for (final xml.XmlElement activity in document.findAllElements('activity')) {
final String enabled = activity.getAttribute('android:enabled');
if (enabled != null && enabled == 'false') {
continue;
}
- for (xml.XmlElement element in activity.findElements('intent-filter')) {
+ for (final xml.XmlElement element in activity.findElements('intent-filter')) {
String actionName = '';
String categoryName = '';
- for (xml.XmlNode node in element.children) {
+ for (final xml.XmlNode node in element.children) {
if (node is! xml.XmlElement) {
continue;
}
@@ -511,7 +511,7 @@
static bool isAttributeWithValuePresent(_Element baseElement,
String childElement, String attributeName, String attributeValue) {
final Iterable<_Element> allElements = baseElement.allElements(childElement);
- for (_Element oneElement in allElements) {
+ for (final _Element oneElement in allElements) {
final String elementAttributeValue = oneElement
?.firstAttribute(attributeName)
?.value;
@@ -535,7 +535,7 @@
final _Element manifest = _Element.fromLine(lines[manifestLine], null);
_Element currentElement = manifest;
- for (String line in lines.skip(manifestLine)) {
+ for (final String line in lines.skip(manifestLine)) {
final String trimLine = line.trimLeft();
final int level = line.length - trimLine.length;
@@ -564,7 +564,7 @@
final Iterable<_Element> activities = application.allElements('activity');
_Element launchActivity;
- for (_Element activity in activities) {
+ for (final _Element activity in activities) {
final _Attribute enabled = activity.firstAttribute('android:enabled');
final Iterable<_Element> intentFilters = activity.allElements('intent-filter');
final bool isEnabledByDefault = enabled == null;
@@ -573,7 +573,7 @@
continue;
}
- for (_Element element in intentFilters) {
+ for (final _Element element in intentFilters) {
final bool isMainAction = isAttributeWithValuePresent(
element, 'action', 'android:name', '"android.intent.action.MAIN"');
if (!isMainAction) {
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index 60f6ef6..e9d7c46 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -509,7 +509,7 @@
String _genSnapshotPath() {
const List<String> clangDirs = <String>['.', 'clang_x64', 'clang_x86', 'clang_i386'];
final String genSnapshotName = _artifactToFileName(Artifact.genSnapshot);
- for (String clangDir in clangDirs) {
+ for (final String clangDir in clangDirs) {
final String genSnapshotPath = globals.fs.path.join(engineOutPath, clangDir, genSnapshotName);
if (globals.processManager.canRun(genSnapshotPath)) {
return genSnapshotPath;
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index 3c151c9..d1a4706 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -89,11 +89,11 @@
return true;
}
- for (Directory directory in _wildcardDirectories.values) {
+ for (final Directory directory in _wildcardDirectories.values) {
if (!directory.existsSync()) {
return true; // directory was deleted.
}
- for (File file in directory.listSync().whereType<File>()) {
+ for (final File file in directory.listSync().whereType<File>()) {
final DateTime dateTime = file.statSync().modified;
if (dateTime == null) {
continue;
@@ -166,7 +166,7 @@
);
// Add fonts and assets from packages.
- for (String packageName in packageMap.map.keys) {
+ for (final String packageName in packageMap.map.keys) {
final Uri package = packageMap.map[packageName];
if (package != null && package.scheme == 'file') {
final String packageManifestPath = globals.fs.path.fromUri(package.resolve('../pubspec.yaml'));
@@ -204,7 +204,7 @@
// Save the contents of each image, image variant, and font
// asset in entries.
- for (_Asset asset in assetVariants.keys) {
+ for (final _Asset asset in assetVariants.keys) {
if (!asset.assetFileExists && assetVariants[asset].isEmpty) {
globals.printStatus('Error detected in pubspec.yaml:', emphasis: true);
globals.printError('No file or variants found for $asset.\n');
@@ -220,7 +220,7 @@
assert(!assetVariants[asset].contains(asset));
assetVariants[asset].insert(0, asset);
}
- for (_Asset variant in assetVariants[asset]) {
+ for (final _Asset variant in assetVariants[asset]) {
assert(variant.assetFileExists);
entries[variant.entryUri.path] ??= DevFSFileContent(variant.assetFile);
}
@@ -230,13 +230,13 @@
if (flutterManifest.usesMaterialDesign && includeDefaultFonts)
..._getMaterialAssets(_fontSetMaterial),
];
- for (_Asset asset in materialAssets) {
+ for (final _Asset asset in materialAssets) {
assert(asset.assetFileExists);
entries[asset.entryUri.path] ??= DevFSFileContent(asset.assetFile);
}
// Update wildcard directories we we can detect changes in them.
- for (Uri uri in wildcardDirectories) {
+ for (final Uri uri in wildcardDirectories) {
_wildcardDirectories[uri] ??= globals.fs.directory(uri);
}
@@ -321,8 +321,8 @@
List<_Asset> _getMaterialAssets(String fontSet) {
final List<_Asset> result = <_Asset>[];
- for (Map<String, dynamic> family in _getMaterialFonts(fontSet)) {
- for (Map<dynamic, dynamic> font in family['fonts']) {
+ for (final Map<String, dynamic> family in _getMaterialFonts(fontSet)) {
+ for (final Map<dynamic, dynamic> font in family['fonts']) {
final Uri entryUri = globals.fs.path.toUri(font['asset'] as String);
result.add(_Asset(
baseDir: globals.fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'),
@@ -358,7 +358,7 @@
// sources, and might need to include a license for each one.)
final Map<String, Set<String>> packageLicenses = <String, Set<String>>{};
final Set<String> allPackages = <String>{};
- for (String packageName in packageMap.map.keys) {
+ for (final String packageName in packageMap.map.keys) {
final Uri package = packageMap.map[packageName];
if (package == null || package.scheme != 'file') {
continue;
@@ -369,7 +369,7 @@
}
final List<String> rawLicenses =
file.readAsStringSync().split(_licenseSeparator);
- for (String rawLicense in rawLicenses) {
+ for (final String rawLicense in rawLicenses) {
List<String> packageNames;
String licenseText;
if (rawLicenses.length > 1) {
@@ -421,9 +421,9 @@
.keys.toList()
..sort(_byBasename);
- for (_Asset main in sortedKeys) {
+ for (final _Asset main in sortedKeys) {
jsonObject[main.entryUri.path] = <String>[
- for (_Asset variant in assetVariants[main])
+ for (final _Asset variant in assetVariants[main])
variant.entryUri.path,
];
}
@@ -458,9 +458,9 @@
PackageMap packageMap,
) {
final List<Font> packageFonts = <Font>[];
- for (Font font in manifest.fonts) {
+ for (final Font font in manifest.fonts) {
final List<FontAsset> packageFontAssets = <FontAsset>[];
- for (FontAsset fontAsset in font.fontAssets) {
+ for (final FontAsset fontAsset in font.fontAssets) {
final Uri assetUri = fontAsset.assetUri;
if (assetUri.pathSegments.first == 'packages' &&
!globals.fs.isFileSync(globals.fs.path.fromUri(packageMap.map[packageName].resolve('../${assetUri.path}')))) {
@@ -513,7 +513,7 @@
if (_cache[directory] == null) {
final List<String> paths = <String>[];
- for (FileSystemEntity entity in globals.fs.directory(directory).listSync(recursive: true)) {
+ for (final FileSystemEntity entity in globals.fs.directory(directory).listSync(recursive: true)) {
final String path = entity.path;
if (globals.fs.isFileSync(path) && !_excluded.any((String exclude) => path.startsWith(exclude))) {
paths.add(path);
@@ -521,7 +521,7 @@
}
final Map<String, List<String>> variants = <String, List<String>>{};
- for (String path in paths) {
+ for (final String path in paths) {
final String variantName = globals.fs.path.basename(path);
if (directory == globals.fs.path.dirname(path)) {
continue;
@@ -572,7 +572,7 @@
final Map<_Asset, List<_Asset>> result = <_Asset, List<_Asset>>{};
final _AssetDirectoryCache cache = _AssetDirectoryCache(excludeDirs);
- for (Uri assetUri in flutterManifest.assets) {
+ for (final Uri assetUri in flutterManifest.assets) {
if (assetUri.toString().endsWith('/')) {
wildcardDirectories.add(assetUri);
_parseAssetsFromFolder(packageMap, flutterManifest, assetBase,
@@ -586,8 +586,8 @@
}
// Add assets referenced in the fonts section of the manifest.
- for (Font font in flutterManifest.fonts) {
- for (FontAsset fontAsset in font.fontAssets) {
+ for (final Font font in flutterManifest.fonts) {
+ for (final FontAsset fontAsset in font.fontAssets) {
final _Asset baseAsset = _resolveAsset(
packageMap,
assetBase,
@@ -626,7 +626,7 @@
final List<FileSystemEntity> lister = globals.fs.directory(directoryPath).listSync();
- for (FileSystemEntity entity in lister) {
+ for (final FileSystemEntity entity in lister) {
if (entity is File) {
final String relativePath = globals.fs.path.relative(entity.path, from: assetBase);
@@ -655,7 +655,7 @@
packageName,
);
final List<_Asset> variants = <_Asset>[];
- for (String path in cache.variantsFor(asset.assetFile.path)) {
+ for (final String path in cache.variantsFor(asset.assetFile.path)) {
final String relativePath = globals.fs.path.relative(path, from: asset.baseDir);
final Uri relativeUri = globals.fs.path.toUri(relativePath);
final Uri entryUri = asset.symbolicPrefixUri == null
diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart
index 9d5c8fc..15e7bc9 100644
--- a/packages/flutter_tools/lib/src/base/build.dart
+++ b/packages/flutter_tools/lib/src/base/build.dart
@@ -185,7 +185,7 @@
final bool stripSymbols = platform == TargetPlatform.ios && buildMode == BuildMode.release && bitcode;
if (stripSymbols) {
final IOSink sink = globals.fs.file('$assembly.stripped.S').openWrite();
- for (String line in globals.fs.file(assembly).readAsLinesSync()) {
+ for (final String line in globals.fs.file(assembly).readAsLinesSync()) {
if (line.startsWith('.section __DWARF')) {
break;
}
diff --git a/packages/flutter_tools/lib/src/base/file_system.dart b/packages/flutter_tools/lib/src/base/file_system.dart
index 4100d77..6e3ccce 100644
--- a/packages/flutter_tools/lib/src/base/file_system.dart
+++ b/packages/flutter_tools/lib/src/base/file_system.dart
@@ -42,7 +42,7 @@
destDir.createSync(recursive: true);
}
- for (FileSystemEntity entity in srcDir.listSync()) {
+ for (final FileSystemEntity entity in srcDir.listSync()) {
final String newPath = destDir.fileSystem.path.join(destDir.path, entity.basename);
if (entity is File) {
final File newFile = destDir.fileSystem.file(newPath);
diff --git a/packages/flutter_tools/lib/src/base/fingerprint.dart b/packages/flutter_tools/lib/src/base/fingerprint.dart
index 5fc0b2f..9ef80c7 100644
--- a/packages/flutter_tools/lib/src/base/fingerprint.dart
+++ b/packages/flutter_tools/lib/src/base/fingerprint.dart
@@ -87,7 +87,7 @@
List<String> _getPaths() {
final Set<String> paths = <String>{
..._paths,
- for (String depfilePath in _depfilePaths)
+ for (final String depfilePath in _depfilePaths)
...readDepfile(depfilePath),
};
final FingerprintPathFilter filter = _pathFilter ?? (String path) => true;
@@ -108,7 +108,7 @@
}
_checksums = <String, String>{};
- for (File file in files) {
+ for (final File file in files) {
final List<int> bytes = file.readAsBytesSync();
_checksums[file.path] = md5.convert(bytes).toString();
}
diff --git a/packages/flutter_tools/lib/src/base/net.dart b/packages/flutter_tools/lib/src/base/net.dart
index 150e1a1..38fa19c 100644
--- a/packages/flutter_tools/lib/src/base/net.dart
+++ b/packages/flutter_tools/lib/src/base/net.dart
@@ -187,7 +187,7 @@
@override
void writeAll(Iterable<dynamic> objects, [ String separator = '' ]) {
bool addSeparator = false;
- for (dynamic object in objects) {
+ for (final dynamic object in objects) {
if (addSeparator) {
write(separator);
}
diff --git a/packages/flutter_tools/lib/src/base/os.dart b/packages/flutter_tools/lib/src/base/os.dart
index f07c758..b0cd1d4 100644
--- a/packages/flutter_tools/lib/src/base/os.dart
+++ b/packages/flutter_tools/lib/src/base/os.dart
@@ -248,7 +248,7 @@
@override
void zip(Directory data, File zipFile) {
final Archive archive = Archive();
- for (FileSystemEntity entity in data.listSync(recursive: true)) {
+ for (final FileSystemEntity entity in data.listSync(recursive: true)) {
if (entity is! File) {
continue;
}
@@ -299,7 +299,7 @@
}
void _unpackArchive(Archive archive, Directory targetDirectory) {
- for (ArchiveFile archiveFile in archive.files) {
+ for (final ArchiveFile archiveFile in archive.files) {
// The archive package doesn't correctly set isFile.
if (!archiveFile.isFile || archiveFile.name.endsWith('/')) {
continue;
diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart
index e2e6128..fb634e8 100644
--- a/packages/flutter_tools/lib/src/base/process.dart
+++ b/packages/flutter_tools/lib/src/base/process.dart
@@ -78,11 +78,11 @@
globals.printTrace('Running shutdown hooks');
_shutdownHooksRunning = true;
try {
- for (ShutdownStage stage in _shutdownHooks.keys.toList()..sort()) {
+ for (final ShutdownStage stage in _shutdownHooks.keys.toList()..sort()) {
globals.printTrace('Shutdown hook priority ${stage.priority}');
final List<ShutdownHook> hooks = _shutdownHooks.remove(stage);
final List<Future<dynamic>> futures = <Future<dynamic>>[];
- for (ShutdownHook shutdownHook in hooks) {
+ for (final ShutdownHook shutdownHook in hooks) {
final FutureOr<dynamic> result = shutdownHook();
if (result is Future<dynamic>) {
futures.add(result);
diff --git a/packages/flutter_tools/lib/src/base/signals.dart b/packages/flutter_tools/lib/src/base/signals.dart
index 3899d4f..28b9e67 100644
--- a/packages/flutter_tools/lib/src/base/signals.dart
+++ b/packages/flutter_tools/lib/src/base/signals.dart
@@ -114,7 +114,7 @@
}
Future<void> _handleSignal(ProcessSignal s) async {
- for (SignalHandler handler in _handlersList[s]) {
+ for (final SignalHandler handler in _handlersList[s]) {
try {
await asyncGuard<void>(() async => handler(s));
} catch (e) {
diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart
index 0cfcc72..b246d10 100644
--- a/packages/flutter_tools/lib/src/base/utils.dart
+++ b/packages/flutter_tools/lib/src/base/utils.dart
@@ -319,7 +319,7 @@
hangingIndent ??= 0;
final List<String> splitText = text.split('\n');
final List<String> result = <String>[];
- for (String line in splitText) {
+ for (final String line in splitText) {
String trimmedText = line.trimLeft();
final String leadingWhitespace = line.substring(0, line.length - trimmedText.length);
List<String> notIndented;
@@ -433,7 +433,7 @@
final RegExp characterOrCode = RegExp('(\u001b\[[0-9;]*m|.)', multiLine: true);
List<_AnsiRun> result = <_AnsiRun>[];
final StringBuffer current = StringBuffer();
- for (Match match in characterOrCode.allMatches(input)) {
+ for (final Match match in characterOrCode.allMatches(input)) {
current.write(match[0]);
if (match[0].length < 4) {
// This is a regular character, write it out.
@@ -461,7 +461,7 @@
final List<String> result = <String>[];
final int effectiveLength = max(columnWidth - start, kMinColumnWidth);
- for (String line in text.split('\n')) {
+ for (final String line in text.split('\n')) {
// If the line is short enough, even with ANSI codes, then we can just add
// add it and move on.
if (line.length <= effectiveLength || !shouldWrap) {
diff --git a/packages/flutter_tools/lib/src/base/version.dart b/packages/flutter_tools/lib/src/base/version.dart
index 5e79435..e89772c 100644
--- a/packages/flutter_tools/lib/src/base/version.dart
+++ b/packages/flutter_tools/lib/src/base/version.dart
@@ -52,7 +52,7 @@
/// This is the highest-numbered stable version.
static Version primary(List<Version> versions) {
Version primary;
- for (Version version in versions) {
+ for (final Version version in versions) {
if (primary == null || (version > primary)) {
primary = version;
}
diff --git a/packages/flutter_tools/lib/src/build_runner/build_runner.dart b/packages/flutter_tools/lib/src/build_runner/build_runner.dart
index 082605f..0a9334e 100644
--- a/packages/flutter_tools/lib/src/build_runner/build_runner.dart
+++ b/packages/flutter_tools/lib/src/build_runner/build_runner.dart
@@ -78,7 +78,7 @@
stringBuffer.writeln('dependencies:');
final YamlMap builders = flutterProject.builders;
if (builders != null) {
- for (String name in builders.keys.cast<String>()) {
+ for (final String name in builders.keys.cast<String>()) {
final Object node = builders[name];
// For relative paths, make sure it is accounted for
// parent directories.
diff --git a/packages/flutter_tools/lib/src/build_runner/web_compilation_delegate.dart b/packages/flutter_tools/lib/src/build_runner/web_compilation_delegate.dart
index de5f20d..df9c642 100644
--- a/packages/flutter_tools/lib/src/build_runner/web_compilation_delegate.dart
+++ b/packages/flutter_tools/lib/src/build_runner/web_compilation_delegate.dart
@@ -60,7 +60,7 @@
);
client.startBuild();
bool success = true;
- await for (BuildResults results in client.buildResults) {
+ await for (final BuildResults results in client.buildResults) {
final BuildResult result = results.results.firstWhere((BuildResult result) {
return result.target == 'web';
});
@@ -81,7 +81,7 @@
final Iterable<Directory> childDirectories = rootDirectory
.listSync()
.whereType<Directory>();
- for (Directory childDirectory in childDirectories) {
+ for (final Directory childDirectory in childDirectories) {
final String path = globals.fs.path.join(testOutputDir, 'packages',
globals.fs.path.basename(childDirectory.path));
copyDirectorySync(childDirectory.childDirectory('lib'), globals.fs.directory(path));
@@ -135,7 +135,7 @@
Stream<AssetId> findAssets(Glob glob, {String package}) async* {
if (package == null || packageGraph.root.name == package) {
final String generatedRoot = globals.fs.path.join(generatedDirectory.path, packageGraph.root.name);
- await for (io.FileSystemEntity entity in glob.list(followLinks: true, root: packageGraph.root.path)) {
+ await for (final io.FileSystemEntity entity in glob.list(followLinks: true, root: packageGraph.root.path)) {
if (entity is io.File && _isNotHidden(entity) && !globals.fs.path.isWithin(generatedRoot, entity.path)) {
yield _fileToAssetId(entity, packageGraph.root);
}
@@ -143,7 +143,7 @@
if (!globals.fs.isDirectorySync(generatedRoot)) {
return;
}
- await for (io.FileSystemEntity entity in glob.list(followLinks: true, root: generatedRoot)) {
+ await for (final io.FileSystemEntity entity in glob.list(followLinks: true, root: generatedRoot)) {
if (entity is io.File && _isNotHidden(entity)) {
yield _fileToAssetId(entity, packageGraph.root, globals.fs.path.relative(generatedRoot), true);
}
diff --git a/packages/flutter_tools/lib/src/build_runner/web_fs.dart b/packages/flutter_tools/lib/src/build_runner/web_fs.dart
index 1e9c0bd..f4c97b6 100644
--- a/packages/flutter_tools/lib/src/build_runner/web_fs.dart
+++ b/packages/flutter_tools/lib/src/build_runner/web_fs.dart
@@ -154,7 +154,7 @@
return true;
}
_client.startBuild();
- await for (BuildResults results in _client.buildResults) {
+ await for (final BuildResults results in _client.buildResults) {
final BuildResult result = results.results.firstWhere((BuildResult result) {
return result.target == kBuildTargetName;
});
@@ -367,7 +367,7 @@
@override
Future<Response> handle(Request request) async {
Uri fileUri;
- for (Uri uri in _searchPaths) {
+ for (final Uri uri in _searchPaths) {
final Uri potential = uri.resolve(request.url.path);
if (potential == null || !globals.fs.isFileSync(potential.toFilePath())) {
continue;
@@ -445,7 +445,7 @@
final Archive archive = TarDecoder().decodeBytes(dart2jsArchive.readAsBytesSync());
partFiles = globals.fs.systemTempDirectory.createTempSync('flutter_tool.')
..createSync();
- for (ArchiveFile file in archive) {
+ for (final ArchiveFile file in archive) {
partFiles.childFile(file.name).writeAsBytesSync(file.content as List<int>);
}
}
@@ -664,7 +664,7 @@
'--define', 'flutter_tools:shell=initializePlatform=$initializePlatform',
// The following will cause build runner to only build tests that were requested.
if (testTargets != null && testTargets.hasBuildFilters)
- for (String buildFilter in testTargets.buildFilters)
+ for (final String buildFilter in testTargets.buildFilters)
'--build-filter=$buildFilter',
];
diff --git a/packages/flutter_tools/lib/src/build_system/build_system.dart b/packages/flutter_tools/lib/src/build_system/build_system.dart
index 1f67a56..6f4f85a 100644
--- a/packages/flutter_tools/lib/src/build_system/build_system.dart
+++ b/packages/flutter_tools/lib/src/build_system/build_system.dart
@@ -138,7 +138,7 @@
inputsFiles.sources,
outputFiles.sources,
<Node>[
- for (Target target in dependencies) target._toNode(environment),
+ for (final Target target in dependencies) target._toNode(environment),
],
environment,
inputsFiles.containsNewDepfile,
@@ -160,11 +160,11 @@
) {
final File stamp = _findStampFile(environment);
final List<String> inputPaths = <String>[];
- for (File input in inputs) {
+ for (final File input in inputs) {
inputPaths.add(input.path);
}
final List<String> outputPaths = <String>[];
- for (File output in outputs) {
+ for (final File output in outputs) {
outputPaths.add(output.path);
}
final Map<String, Object> result = <String, Object>{
@@ -207,13 +207,13 @@
return <String, Object>{
'name': name,
'dependencies': <String>[
- for (Target target in dependencies) target.name,
+ for (final Target target in dependencies) target.name,
],
'inputs': <String>[
- for (File file in resolveInputs(environment).sources) file.path,
+ for (final File file in resolveInputs(environment).sources) file.path,
],
'outputs': <String>[
- for (File file in resolveOutputs(environment).sources) file.path,
+ for (final File file in resolveOutputs(environment).sources) file.path,
],
'stamp': _findStampFile(environment).absolute.path,
};
@@ -229,7 +229,7 @@
List<String> depfiles, Environment environment, { bool implicit = true, bool inputs = true,
}) {
final SourceVisitor collector = SourceVisitor(environment, inputs);
- for (Source source in config) {
+ for (final Source source in config) {
source.accept(collector);
}
depfiles.forEach(collector.visitDepfile);
@@ -292,7 +292,7 @@
String buildPrefix;
final List<String> keys = defines.keys.toList()..sort();
final StringBuffer buffer = StringBuffer();
- for (String key in keys) {
+ for (final String key in keys) {
buffer.write(key);
buffer.write(defines[key]);
}
@@ -502,10 +502,10 @@
// these files are included as both inputs and outputs then it isn't
// possible to construct a DAG describing the build.
void updateGraph() {
- for (File output in node.outputs) {
+ for (final File output in node.outputs) {
outputFiles[output.path] = output;
}
- for (File input in node.inputs) {
+ for (final File input in node.inputs) {
final String resolvedPath = input.absolute.path;
if (outputFiles.containsKey(resolvedPath)) {
continue;
@@ -550,7 +550,7 @@
// Delete outputs from previous stages that are no longer a part of the
// build.
- for (String previousOutput in node.previousOutputs) {
+ for (final String previousOutput in node.previousOutputs) {
if (outputFiles.containsKey(previousOutput)) {
continue;
}
@@ -614,7 +614,7 @@
}
visited.add(target);
stack.add(target);
- for (Target dependency in target.dependencies) {
+ for (final Target dependency in target.dependencies) {
checkInternal(dependency, visited, stack);
}
stack.remove(target);
@@ -627,7 +627,7 @@
final String buildDirectory = environment.buildDir.resolveSymbolicLinksSync();
final String projectDirectory = environment.projectDir.resolveSymbolicLinksSync();
final List<File> missingOutputs = <File>[];
- for (File sourceFile in outputs) {
+ for (final File sourceFile in outputs) {
if (!sourceFile.existsSync()) {
missingOutputs.add(sourceFile);
continue;
@@ -733,13 +733,13 @@
FileHashStore fileHashStore,
) async {
final Set<String> currentOutputPaths = <String>{
- for (File file in outputs) file.path,
+ for (final File file in outputs) file.path,
};
// For each input, first determine if we've already computed the hash
// for it. Then collect it to be sent off for hashing as a group.
final List<File> sourcesToHash = <File>[];
final List<File> missingInputs = <File>[];
- for (File file in inputs) {
+ for (final File file in inputs) {
if (!file.existsSync()) {
missingInputs.add(file);
continue;
@@ -760,7 +760,7 @@
// For each output, first determine if we've already computed the hash
// for it. Then collect it to be sent off for hashing as a group.
- for (String previousOutput in previousOutputs) {
+ for (final String previousOutput in previousOutputs) {
// output paths changed.
if (!currentOutputPaths.contains(previousOutput)) {
_dirty = true;
diff --git a/packages/flutter_tools/lib/src/build_system/depfile.dart b/packages/flutter_tools/lib/src/build_system/depfile.dart
index 6e777af..6ae6021 100644
--- a/packages/flutter_tools/lib/src/build_system/depfile.dart
+++ b/packages/flutter_tools/lib/src/build_system/depfile.dart
@@ -31,7 +31,7 @@
/// file must be manually specified.
factory Depfile.parseDart2js(File file, File output) {
final List<File> inputs = <File>[];
- for (String rawUri in file.readAsLinesSync()) {
+ for (final String rawUri in file.readAsLinesSync()) {
if (rawUri.trim().isEmpty) {
continue;
}
@@ -72,7 +72,7 @@
}
void _writeFilesToBuffer(List<File> files, StringBuffer buffer) {
- for (File outputFile in files) {
+ for (final File outputFile in files) {
if (globals.platform.isWindows) {
// Paths in a depfile have to be escaped on windows.
final String escapedPath = outputFile.path.replaceAll(r'\', r'\\');
diff --git a/packages/flutter_tools/lib/src/build_system/file_hash_store.dart b/packages/flutter_tools/lib/src/build_system/file_hash_store.dart
index 72925ee..0879c7b 100644
--- a/packages/flutter_tools/lib/src/build_system/file_hash_store.dart
+++ b/packages/flutter_tools/lib/src/build_system/file_hash_store.dart
@@ -24,7 +24,7 @@
final int version = json['version'] as int;
final List<Map<String, Object>> rawCachedFiles = (json['files'] as List<dynamic>).cast<Map<String, Object>>();
final List<FileHash> cachedFiles = <FileHash>[
- for (Map<String, Object> rawFile in rawCachedFiles) FileHash.fromJson(rawFile),
+ for (final Map<String, Object> rawFile in rawCachedFiles) FileHash.fromJson(rawFile),
];
return FileStorage(version, cachedFiles);
}
@@ -36,7 +36,7 @@
final Map<String, Object> json = <String, Object>{
'version': version,
'files': <Object>[
- for (FileHash file in files) file.toJson(),
+ for (final FileHash file in files) file.toJson(),
],
};
return utf8.encode(jsonEncode(json));
@@ -118,7 +118,7 @@
cacheFile.deleteSync();
return;
}
- for (FileHash fileHash in fileStorage.files) {
+ for (final FileHash fileHash in fileStorage.files) {
previousHashes[fileHash.path] = fileHash.hash;
}
globals.printTrace('Done initializing file store');
@@ -132,7 +132,7 @@
cacheFile.createSync(recursive: true);
}
final List<FileHash> fileHashes = <FileHash>[];
- for (MapEntry<String, String> entry in currentHashes.entries) {
+ for (final MapEntry<String, String> entry in currentHashes.entries) {
fileHashes.add(FileHash(entry.key, entry.value));
}
final FileStorage fileStorage = FileStorage(
@@ -158,7 +158,7 @@
final List<File> dirty = <File>[];
final Pool openFiles = Pool(kMaxOpenFiles);
await Future.wait(<Future<void>>[
- for (File file in files) _hashFile(file, dirty, openFiles)
+ for (final File file in files) _hashFile(file, dirty, openFiles)
]);
return dirty;
}
diff --git a/packages/flutter_tools/lib/src/build_system/source.dart b/packages/flutter_tools/lib/src/build_system/source.dart
index eb35f95..e0df5cb 100644
--- a/packages/flutter_tools/lib/src/build_system/source.dart
+++ b/packages/flutter_tools/lib/src/build_system/source.dart
@@ -146,7 +146,7 @@
if (!globals.fs.directory(filePath).existsSync()) {
throw Exception('$filePath does not exist!');
}
- for (FileSystemEntity entity in globals.fs.directory(filePath).listSync()) {
+ for (final FileSystemEntity entity in globals.fs.directory(filePath).listSync()) {
final String filename = globals.fs.path.basename(entity.path);
if (wildcardSegments.isEmpty) {
sources.add(globals.fs.file(entity.absolute));
diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart
index 1d9152a..032e270 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart
@@ -59,7 +59,7 @@
// If we're building multiple iOS archs the binaries need to be lipo'd
// together.
final List<Future<int>> pending = <Future<int>>[];
- for (DarwinArch iosArch in iosArchs) {
+ for (final DarwinArch iosArch in iosArchs) {
pending.add(snapshotter.build(
platform: targetPlatform,
buildMode: buildMode,
diff --git a/packages/flutter_tools/lib/src/build_system/targets/linux.dart b/packages/flutter_tools/lib/src/build_system/targets/linux.dart
index 706b788..8375ecd 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/linux.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/linux.dart
@@ -59,7 +59,7 @@
);
// The native linux artifacts are composed of 6 files and a directory (listed above)
// which need to be copied to the target directory.
- for (String artifact in _kLinuxArtifacts) {
+ for (final String artifact in _kLinuxArtifacts) {
final String entityPath = globals.fs.path.join(basePath, artifact);
// If this artifact is a file, just copy the source over.
if (globals.fs.isFileSync(entityPath)) {
@@ -79,7 +79,7 @@
}
// If the artifact is the directory cpp_client_wrapper, recursively
// copy every file from it.
- for (File input in globals.fs.directory(entityPath)
+ for (final File input in globals.fs.directory(entityPath)
.listSync(recursive: true)
.whereType<File>()) {
final String outputPath = globals.fs.path.join(
diff --git a/packages/flutter_tools/lib/src/build_system/targets/web.dart b/packages/flutter_tools/lib/src/build_system/targets/web.dart
index 97e0a00..00d9f63 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/web.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/web.dart
@@ -170,7 +170,7 @@
'-Ddart.vm.profile=true'
else
'-Ddart.vm.product=true',
- for (String dartDefine in parseDartDefines(environment))
+ for (final String dartDefine in parseDartDefines(environment))
'-D$dartDefine',
environment.buildDir.childFile('main.dart').path,
]);
@@ -224,7 +224,7 @@
@override
Future<void> build(Environment environment) async {
- for (File outputFile in environment.buildDir.listSync(recursive: true).whereType<File>()) {
+ for (final File outputFile in environment.buildDir.listSync(recursive: true).whereType<File>()) {
if (!globals.fs.path.basename(outputFile.path).contains('main.dart.js')) {
continue;
}
diff --git a/packages/flutter_tools/lib/src/build_system/targets/windows.dart b/packages/flutter_tools/lib/src/build_system/targets/windows.dart
index 5b05aa1..ce1ee7b 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/windows.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/windows.dart
@@ -41,7 +41,7 @@
Future<void> build(Environment environment) async {
// This path needs to match the prefix in the rule below.
final String basePath = globals.artifacts.getArtifactPath(Artifact.windowsDesktopPath);
- for (File input in globals.fs.directory(basePath)
+ for (final File input in globals.fs.directory(basePath)
.listSync(recursive: true)
.whereType<File>()) {
final String outputPath = globals.fs.path.join(
diff --git a/packages/flutter_tools/lib/src/bundle.dart b/packages/flutter_tools/lib/src/bundle.dart
index 2a3c938..b496587 100644
--- a/packages/flutter_tools/lib/src/bundle.dart
+++ b/packages/flutter_tools/lib/src/bundle.dart
@@ -126,7 +126,7 @@
final BuildResult result = await buildSystem.build(target, environment);
if (!result.success) {
- for (ExceptionMeasurement measurement in result.exceptions.values) {
+ for (final ExceptionMeasurement measurement in result.exceptions.values) {
globals.printError('Target ${measurement.target} failed: ${measurement.exception}',
stackTrace: measurement.fatal
? measurement.stackTrace
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index 821f4c2..4320f34 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -108,7 +108,7 @@
_artifacts.add(MacOSFuchsiaSDKArtifacts(this));
_artifacts.add(FlutterRunnerSDKArtifacts(this));
_artifacts.add(FlutterRunnerDebugSymbols(this));
- for (String artifactName in IosUsbArtifacts.artifactNames) {
+ for (final String artifactName in IosUsbArtifacts.artifactNames) {
_artifacts.add(IosUsbArtifacts(artifactName, this));
}
} else {
@@ -300,7 +300,7 @@
return _dyLdLibEntry;
}
final List<String> paths = <String>[];
- for (ArtifactSet artifact in _artifacts) {
+ for (final ArtifactSet artifact in _artifacts) {
final Map<String, String> env = artifact.environment;
if (env == null || !env.containsKey('DYLD_LIBRARY_PATH')) {
continue;
@@ -378,7 +378,7 @@
if (!_lockEnabled) {
return;
}
- for (ArtifactSet artifact in _artifacts) {
+ for (final ArtifactSet artifact in _artifacts) {
if (!requiredArtifacts.contains(artifact.developmentArtifact)) {
globals.printTrace('Artifact $artifact is not required, skipping update.');
continue;
@@ -409,7 +409,7 @@
final bool includeAllPlatformsState = globals.cache.includeAllPlatforms;
bool allAvailible = true;
globals.cache.includeAllPlatforms = includeAllPlatforms;
- for (ArtifactSet cachedArtifact in _artifacts) {
+ for (final ArtifactSet cachedArtifact in _artifacts) {
if (cachedArtifact is EngineCachedArtifact) {
allAvailible &= await cachedArtifact.checkForArtifacts(engineVersion);
}
@@ -496,7 +496,7 @@
/// Clear any zip/gzip files downloaded.
void _removeDownloadedFiles() {
- for (File f in downloadedFiles) {
+ for (final File f in downloadedFiles) {
try {
f.deleteSync();
} on FileSystemException catch (e) {
@@ -606,7 +606,7 @@
final Uri url = Uri.parse('${cache.storageBaseUrl}/flutter_infra/flutter/$version/$platformName.zip');
await _downloadZipArchive('Downloading Web SDK...', url, location);
// This is a temporary work-around for not being able to safely download into a shared directory.
- for (FileSystemEntity entity in location.listSync(recursive: true)) {
+ for (final FileSystemEntity entity in location.listSync(recursive: true)) {
if (entity is File) {
final List<String> segments = globals.fs.path.split(entity.path);
segments.remove('flutter_web_sdk');
@@ -643,21 +643,21 @@
@override
bool isUpToDateInner() {
final Directory pkgDir = cache.getCacheDir('pkg');
- for (String pkgName in getPackageDirs()) {
+ for (final String pkgName in getPackageDirs()) {
final String pkgPath = globals.fs.path.join(pkgDir.path, pkgName);
if (!globals.fs.directory(pkgPath).existsSync()) {
return false;
}
}
- for (List<String> toolsDir in getBinaryDirs()) {
+ for (final List<String> toolsDir in getBinaryDirs()) {
final Directory dir = globals.fs.directory(globals.fs.path.join(location.path, toolsDir[0]));
if (!dir.existsSync()) {
return false;
}
}
- for (String licenseDir in getLicenseDirs()) {
+ for (final String licenseDir in getLicenseDirs()) {
final File file = globals.fs.file(globals.fs.path.join(location.path, licenseDir, 'LICENSE'));
if (!file.existsSync()) {
return false;
@@ -671,11 +671,11 @@
final String url = '${cache.storageBaseUrl}/flutter_infra/flutter/$version/';
final Directory pkgDir = cache.getCacheDir('pkg');
- for (String pkgName in getPackageDirs()) {
+ for (final String pkgName in getPackageDirs()) {
await _downloadZipArchive('Downloading package $pkgName...', Uri.parse(url + pkgName + '.zip'), pkgDir);
}
- for (List<String> toolsDir in getBinaryDirs()) {
+ for (final List<String> toolsDir in getBinaryDirs()) {
final String cacheDir = toolsDir[0];
final String urlPath = toolsDir[1];
final Directory dir = globals.fs.directory(globals.fs.path.join(location.path, cacheDir));
@@ -684,7 +684,7 @@
_makeFilesExecutable(dir);
const List<String> frameworkNames = <String>['Flutter', 'FlutterMacOS'];
- for (String frameworkName in frameworkNames) {
+ for (final String frameworkName in frameworkNames) {
final File frameworkZip = globals.fs.file(globals.fs.path.join(dir.path, '$frameworkName.framework.zip'));
if (frameworkZip.existsSync()) {
final Directory framework = globals.fs.directory(globals.fs.path.join(dir.path, '$frameworkName.framework'));
@@ -695,7 +695,7 @@
}
final File licenseSource = cache.getLicenseFile();
- for (String licenseDir in getLicenseDirs()) {
+ for (final String licenseDir in getLicenseDirs()) {
final String licenseDestinationPath = globals.fs.path.join(location.path, licenseDir, 'LICENSE');
await licenseSource.copy(licenseDestinationPath);
}
@@ -706,7 +706,7 @@
final String url = '${cache.storageBaseUrl}/flutter_infra/flutter/$engineVersion/';
bool exists = false;
- for (String pkgName in getPackageDirs()) {
+ for (final String pkgName in getPackageDirs()) {
exists = await _doesRemoteExist('Checking package $pkgName is available...',
Uri.parse(url + pkgName + '.zip'));
if (!exists) {
@@ -714,7 +714,7 @@
}
}
- for (List<String> toolsDir in getBinaryDirs()) {
+ for (final List<String> toolsDir in getBinaryDirs()) {
final String cacheDir = toolsDir[0];
final String urlPath = toolsDir[1];
exists = await _doesRemoteExist('Checking $cacheDir tools are available...',
@@ -728,7 +728,7 @@
void _makeFilesExecutable(Directory dir) {
os.chmod(dir, 'a+r,a+x');
- for (FileSystemEntity entity in dir.listSync(recursive: true)) {
+ for (final FileSystemEntity entity in dir.listSync(recursive: true)) {
if (entity is File) {
final FileStat stat = entity.statSync();
final bool isUserExecutable = ((stat.mode >> 6) & 0x1) == 1;
@@ -1000,7 +1000,7 @@
if (!globals.fs.directory(wrapperDir).existsSync()) {
return false;
}
- for (String scriptName in _gradleScripts) {
+ for (final String scriptName in _gradleScripts) {
final File scriptFile = globals.fs.file(globals.fs.path.join(wrapperDir.path, scriptName));
if (!scriptFile.existsSync()) {
return false;
@@ -1189,7 +1189,7 @@
if (executables == null) {
return true;
}
- for (String executable in executables) {
+ for (final String executable in executables) {
if (!location.childFile(executable).existsSync()) {
return false;
}
diff --git a/packages/flutter_tools/lib/src/codegen.dart b/packages/flutter_tools/lib/src/codegen.dart
index 75e1072..6be4fed 100644
--- a/packages/flutter_tools/lib/src/codegen.dart
+++ b/packages/flutter_tools/lib/src/codegen.dart
@@ -118,7 +118,7 @@
codeGenerator.updatePackages(flutterProject);
final CodegenDaemon codegenDaemon = await codeGenerator.daemon(flutterProject);
codegenDaemon.startBuild();
- await for (CodegenStatus codegenStatus in codegenDaemon.buildResults) {
+ await for (final CodegenStatus codegenStatus in codegenDaemon.buildResults) {
if (codegenStatus == CodegenStatus.Failed) {
globals.printError('Code generation failed, build may have compile errors.');
break;
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 568e117..63fb3dc 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -86,8 +86,8 @@
bool get hasConflict => values.length > 1;
bool get hasConflictAffectingFlutterRepo {
assert(globals.fs.path.isAbsolute(Cache.flutterRoot));
- for (List<String> targetSources in values.values) {
- for (String source in targetSources) {
+ for (final List<String> targetSources in values.values) {
+ for (final String source in targetSources) {
assert(globals.fs.path.isAbsolute(source));
if (globals.fs.path.isWithin(Cache.flutterRoot, source)) {
return true;
@@ -100,11 +100,11 @@
assert(hasConflict);
final List<String> targets = values.keys.toList();
targets.sort((String a, String b) => values[b].length.compareTo(values[a].length));
- for (String target in targets) {
+ for (final String target in targets) {
final int count = values[target].length;
result.writeln(' $count ${count == 1 ? 'source wants' : 'sources want'} "$target":');
bool canonical = false;
- for (String source in values[target]) {
+ for (final String source in values[target]) {
result.writeln(' $source');
if (source == canonicalSource) {
canonical = true;
@@ -140,7 +140,7 @@
.readAsStringSync()
.split('\n')
.where((String line) => !line.startsWith(RegExp(r'^ *#')));
- for (String line in lines) {
+ for (final String line in lines) {
final int colon = line.indexOf(':');
if (colon > 0) {
final String packageName = line.substring(0, colon);
@@ -165,7 +165,7 @@
}
void checkForConflictingDependencies(Iterable<Directory> pubSpecDirectories, PackageDependencyTracker dependencies) {
- for (Directory directory in pubSpecDirectories) {
+ for (final Directory directory in pubSpecDirectories) {
final String pubSpecYamlPath = globals.fs.path.join(directory.path, 'pubspec.yaml');
final File pubSpecYamlFile = globals.fs.file(pubSpecYamlPath);
if (pubSpecYamlFile.existsSync()) {
@@ -219,7 +219,7 @@
String generateConflictReport() {
assert(hasConflicts);
final StringBuffer result = StringBuffer();
- for (String package in packages.keys.where((String package) => packages[package].hasConflict)) {
+ for (final String package in packages.keys.where((String package) => packages[package].hasConflict)) {
result.writeln('Package "$package" has conflicts:');
packages[package].describeConflict(result);
}
@@ -228,7 +228,7 @@
Map<String, String> asPackageMap() {
final Map<String, String> result = <String, String>{};
- for (String package in packages.keys) {
+ for (final String package in packages.keys) {
result[package] = packages[package].target;
}
return result;
diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
index 2e9802c..c6271d5 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
@@ -43,7 +43,7 @@
analysisTarget = 'Flutter repository';
globals.printTrace('Analyzing Flutter repository:');
- for (String projectPath in repoRoots) {
+ for (final String projectPath in repoRoots) {
globals.printTrace(' ${globals.fs.path.relative(projectPath)}');
}
} else {
@@ -91,7 +91,7 @@
// Remove errors for deleted files, sort, and print errors.
final List<AnalysisError> errors = <AnalysisError>[];
- for (String path in analysisErrors.keys.toList()) {
+ for (final String path in analysisErrors.keys.toList()) {
if (globals.fs.isFileSync(path)) {
errors.addAll(analysisErrors[path]);
} else {
@@ -112,7 +112,7 @@
errors.sort();
- for (AnalysisError error in errors) {
+ for (final AnalysisError error in errors) {
globals.printStatus(error.toString());
if (error.code != null) {
globals.printTrace('error code: ${error.code}');
diff --git a/packages/flutter_tools/lib/src/commands/analyze_once.dart b/packages/flutter_tools/lib/src/commands/analyze_once.dart
index aaa44df..db2b724 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_once.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_once.dart
@@ -41,7 +41,7 @@
final Set<String> directories = Set<String>.from(argResults.rest
.map<String>((String path) => globals.fs.path.canonicalize(path)));
if (directories.isNotEmpty) {
- for (String directory in directories) {
+ for (final String directory in directories) {
final FileSystemEntityType type = globals.fs.typeSync(directory);
if (type == FileSystemEntityType.notFound) {
@@ -138,7 +138,7 @@
globals.printStatus('');
}
errors.sort();
- for (AnalysisError error in errors) {
+ for (final AnalysisError error in errors) {
globals.printStatus(error.toString(), hangingIndent: 7);
}
diff --git a/packages/flutter_tools/lib/src/commands/assemble.dart b/packages/flutter_tools/lib/src/commands/assemble.dart
index 583412b..75fc58d 100644
--- a/packages/flutter_tools/lib/src/commands/assemble.dart
+++ b/packages/flutter_tools/lib/src/commands/assemble.dart
@@ -115,11 +115,11 @@
}
final String name = argResults.rest.first;
final Map<String, Target> targetMap = <String, Target>{
- for (Target target in _kDefaultTargets)
+ for (final Target target in _kDefaultTargets)
target.name: target
};
final List<Target> results = <Target>[
- for (String targetName in argResults.rest)
+ for (final String targetName in argResults.rest)
if (targetMap.containsKey(targetName))
targetMap[targetName]
];
@@ -153,7 +153,7 @@
Map<String, String> _parseDefines(List<String> values) {
final Map<String, String> results = <String, String>{};
- for (String chunk in values) {
+ for (final String chunk in values) {
final int indexEquals = chunk.indexOf('=');
if (indexEquals == -1) {
throwToolExit('Improperly formatted define flag: $chunk');
@@ -179,7 +179,7 @@
: null,
));
if (!result.success) {
- for (ExceptionMeasurement measurement in result.exceptions.values) {
+ for (final ExceptionMeasurement measurement in result.exceptions.values) {
globals.printError('Target ${measurement.target} failed: ${measurement.exception}',
stackTrace: measurement.fatal
? measurement.stackTrace
@@ -209,7 +209,7 @@
final File file = globals.fs.file(path);
final StringBuffer buffer = StringBuffer();
// These files are already sorted.
- for (File file in files) {
+ for (final File file in files) {
buffer.writeln(file.path);
}
final String newContents = buffer.toString();
diff --git a/packages/flutter_tools/lib/src/commands/attach.dart b/packages/flutter_tools/lib/src/commands/attach.dart
index 3ce4a89..421b425 100644
--- a/packages/flutter_tools/lib/src/commands/attach.dart
+++ b/packages/flutter_tools/lib/src/commands/attach.dart
@@ -226,7 +226,7 @@
} catch (_) {
isolateDiscoveryProtocol?.dispose();
final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList();
- for (ForwardedPort port in ports) {
+ for (final ForwardedPort port in ports) {
await device.portForwarder.unforward(port);
}
rethrow;
@@ -329,7 +329,7 @@
}
} finally {
final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList();
- for (ForwardedPort port in ports) {
+ for (final ForwardedPort port in ports) {
await device.portForwarder.unforward(port);
}
}
diff --git a/packages/flutter_tools/lib/src/commands/build_aar.dart b/packages/flutter_tools/lib/src/commands/build_aar.dart
index 84a83d8..7b798c6 100644
--- a/packages/flutter_tools/lib/src/commands/build_aar.dart
+++ b/packages/flutter_tools/lib/src/commands/build_aar.dart
@@ -101,7 +101,7 @@
? stringArg('build-number')
: '1.0';
- for (String buildMode in const <String>['debug', 'profile', 'release']) {
+ for (final String buildMode in const <String>['debug', 'profile', 'release']) {
if (boolArg(buildMode)) {
androidBuildInfo.add(AndroidBuildInfo(
BuildInfo(BuildMode.fromName(buildMode), stringArg('flavor')),
diff --git a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart
index bd48a12..3ac3b48 100644
--- a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart
+++ b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart
@@ -158,7 +158,7 @@
bundleBuilder ??= BundleBuilder();
cache ??= globals.cache;
- for (BuildMode mode in buildModes) {
+ for (final BuildMode mode in buildModes) {
globals.printStatus('Building framework for $iosProject in ${getNameForBuildMode(mode)} mode...');
final String xcodeBuildConfiguration = toTitleCase(getNameForBuildMode(mode));
final Directory modeDirectory = outputDirectory.childDirectory(xcodeBuildConfiguration);
@@ -470,8 +470,8 @@
final Directory iPhoneBuildConfiguration = iPhoneBuildOutput.childDirectory('$xcodeBuildConfiguration-iphoneos');
final Directory simulatorBuildConfiguration = simulatorBuildOutput.childDirectory('$xcodeBuildConfiguration-iphonesimulator');
- for (Directory builtProduct in iPhoneBuildConfiguration.listSync(followLinks: false).whereType<Directory>()) {
- for (FileSystemEntity podProduct in builtProduct.listSync(followLinks: false)) {
+ for (final Directory builtProduct in iPhoneBuildConfiguration.listSync(followLinks: false).whereType<Directory>()) {
+ for (final FileSystemEntity podProduct in builtProduct.listSync(followLinks: false)) {
final String podFrameworkName = podProduct.basename;
if (globals.fs.path.extension(podFrameworkName) == '.framework') {
final String binaryName = globals.fs.path.basenameWithoutExtension(podFrameworkName);
diff --git a/packages/flutter_tools/lib/src/commands/clean.dart b/packages/flutter_tools/lib/src/commands/clean.dart
index 5d7bc07..db78584 100644
--- a/packages/flutter_tools/lib/src/commands/clean.dart
+++ b/packages/flutter_tools/lib/src/commands/clean.dart
@@ -73,7 +73,7 @@
try {
final Directory xcodeWorkspace = xcodeProject.xcodeWorkspace;
final XcodeProjectInfo projectInfo = await xcodeProjectInterpreter.getInfo(xcodeWorkspace.parent.path);
- for (String scheme in projectInfo.schemes) {
+ for (final String scheme in projectInfo.schemes) {
xcodeProjectInterpreter.cleanWorkspace(xcodeWorkspace.path, scheme);
}
} catch (error) {
diff --git a/packages/flutter_tools/lib/src/commands/config.dart b/packages/flutter_tools/lib/src/commands/config.dart
index d1626ac..c4ab2c8 100644
--- a/packages/flutter_tools/lib/src/commands/config.dart
+++ b/packages/flutter_tools/lib/src/commands/config.dart
@@ -30,7 +30,7 @@
negatable: false,
hide: !verboseHelp,
help: 'Print config values as json.');
- for (Feature feature in allFeatures) {
+ for (final Feature feature in allFeatures) {
if (feature.configSetting == null) {
continue;
}
@@ -69,7 +69,7 @@
// are available.
final Map<String, Feature> featuresByName = <String, Feature>{};
final String channel = FlutterVersion.instance.channel;
- for (Feature feature in allFeatures) {
+ for (final Feature feature in allFeatures) {
if (feature.configSetting != null) {
featuresByName[feature.configSetting] = feature;
}
@@ -105,7 +105,7 @@
}
if (boolArg('clear-features')) {
- for (Feature feature in allFeatures) {
+ for (final Feature feature in allFeatures) {
if (feature.configSetting != null) {
globals.config.removeValue(feature.configSetting);
}
@@ -140,7 +140,7 @@
_updateConfig('build-dir', buildDir);
}
- for (Feature feature in allFeatures) {
+ for (final Feature feature in allFeatures) {
if (feature.configSetting == null) {
continue;
}
@@ -163,7 +163,7 @@
Future<void> handleMachine() async {
// Get all the current values.
final Map<String, dynamic> results = <String, dynamic>{};
- for (String key in globals.config.keys) {
+ for (final String key in globals.config.keys) {
results[key] = globals.config.getValue(key);
}
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index 823da6a..3de6c2b 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -44,7 +44,7 @@
_ProjectType _stringToProjectType(String value) {
_ProjectType result;
- for (_ProjectType type in _ProjectType.values) {
+ for (final _ProjectType type in _ProjectType.values) {
if (value == getEnumName(type)) {
result = type;
break;
@@ -306,7 +306,7 @@
if (argResults.rest.length > 1) {
String message = 'Multiple output directories specified.';
- for (String arg in argResults.rest) {
+ for (final String arg in argResults.rest) {
if (arg.startsWith('-')) {
message += '\nTry moving $arg to be immediately following $name';
break;
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index 0c30d60..1b7cf43 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -204,7 +204,7 @@
void shutdown({ dynamic error }) {
_commandSubscription?.cancel();
- for (Domain domain in _domainMap.values) {
+ for (final Domain domain in _domainMap.values) {
domain.dispose();
}
if (!_onExitCompleter.isCompleted) {
@@ -791,15 +791,15 @@
/// of properties (id, name, platform, ...).
Future<List<Map<String, dynamic>>> getDevices([ Map<String, dynamic> args ]) async {
return <Map<String, dynamic>>[
- for (PollingDeviceDiscovery discoverer in _discoverers)
- for (Device device in await discoverer.devices)
+ for (final PollingDeviceDiscovery discoverer in _discoverers)
+ for (final Device device in await discoverer.devices)
await _deviceToMap(device),
];
}
/// Enable device events.
Future<void> enable(Map<String, dynamic> args) {
- for (PollingDeviceDiscovery discoverer in _discoverers) {
+ for (final PollingDeviceDiscovery discoverer in _discoverers) {
discoverer.startPolling();
}
return Future<void>.value();
@@ -807,7 +807,7 @@
/// Disable device events.
Future<void> disable(Map<String, dynamic> args) {
- for (PollingDeviceDiscovery discoverer in _discoverers) {
+ for (final PollingDeviceDiscovery discoverer in _discoverers) {
discoverer.stopPolling();
}
return Future<void>.value();
@@ -845,14 +845,14 @@
@override
void dispose() {
- for (PollingDeviceDiscovery discoverer in _discoverers) {
+ for (final PollingDeviceDiscovery discoverer in _discoverers) {
discoverer.dispose();
}
}
/// Return the device matching the deviceId field in the args.
Future<Device> _getDevice(String deviceId) async {
- for (PollingDeviceDiscovery discoverer in _discoverers) {
+ for (final PollingDeviceDiscovery discoverer in _discoverers) {
final Device device = (await discoverer.devices).firstWhere((Device device) => device.id == deviceId, orElse: () => null);
if (device != null) {
return device;
diff --git a/packages/flutter_tools/lib/src/commands/devices.dart b/packages/flutter_tools/lib/src/commands/devices.dart
index dbae667..5b478e9 100644
--- a/packages/flutter_tools/lib/src/commands/devices.dart
+++ b/packages/flutter_tools/lib/src/commands/devices.dart
@@ -38,7 +38,7 @@
final List<String> diagnostics = await deviceManager.getDeviceDiagnostics();
if (diagnostics.isNotEmpty) {
globals.printStatus('');
- for (String diagnostic in diagnostics) {
+ for (final String diagnostic in diagnostics) {
globals.printStatus('• $diagnostic', hangingIndent: 2);
}
}
diff --git a/packages/flutter_tools/lib/src/commands/generate.dart b/packages/flutter_tools/lib/src/commands/generate.dart
index 7b23bae..6d58bea 100644
--- a/packages/flutter_tools/lib/src/commands/generate.dart
+++ b/packages/flutter_tools/lib/src/commands/generate.dart
@@ -26,7 +26,7 @@
final FlutterProject flutterProject = FlutterProject.current();
final CodegenDaemon codegenDaemon = await codeGenerator.daemon(flutterProject);
codegenDaemon.startBuild();
- await for (CodegenStatus codegenStatus in codegenDaemon.buildResults) {
+ await for (final CodegenStatus codegenStatus in codegenDaemon.buildResults) {
if (codegenStatus == CodegenStatus.Failed) {
globals.printError('Code generation failed.');
break;
@@ -44,7 +44,7 @@
return null;
}
final Directory errorCache = errorCacheParent.childDirectory('error_cache');
- for (File errorFile in errorCache.listSync(recursive: true).whereType<File>()) {
+ for (final File errorFile in errorCache.listSync(recursive: true).whereType<File>()) {
try {
final List<Object> errorData = json.decode(errorFile.readAsStringSync()) as List<Object>;
final List<Object> stackData = errorData[1] as List<Object>;
diff --git a/packages/flutter_tools/lib/src/commands/ide_config.dart b/packages/flutter_tools/lib/src/commands/ide_config.dart
index fd1c6fc..f42899a 100644
--- a/packages/flutter_tools/lib/src/commands/ide_config.dart
+++ b/packages/flutter_tools/lib/src/commands/ide_config.dart
@@ -126,7 +126,7 @@
final Set<String> manifest = <String>{};
final Iterable<File> flutterFiles = _flutterRoot.listSync(recursive: true).whereType<File>();
- for (File srcFile in flutterFiles) {
+ for (final File srcFile in flutterFiles) {
final String relativePath = globals.fs.path.relative(srcFile.path, from: _flutterRoot.absolute.path);
// Skip template files in both the ide_templates and templates
@@ -186,7 +186,7 @@
// Look for any files under the template dir that don't exist in the manifest and remove
// them.
final Iterable<File> templateFiles = _templateDirectory.listSync(recursive: true).whereType<File>();
- for (File templateFile in templateFiles) {
+ for (final File templateFile in templateFiles) {
final String relativePath = globals.fs.path.relative(
templateFile.absolute.path,
from: _templateDirectory.absolute.path,
diff --git a/packages/flutter_tools/lib/src/commands/precache.dart b/packages/flutter_tools/lib/src/commands/precache.dart
index d9a6dd2..10b0316 100644
--- a/packages/flutter_tools/lib/src/commands/precache.dart
+++ b/packages/flutter_tools/lib/src/commands/precache.dart
@@ -66,7 +66,7 @@
globals.cache.useUnsignedMacBinaries = true;
}
final Set<DevelopmentArtifact> requiredArtifacts = <DevelopmentArtifact>{};
- for (DevelopmentArtifact artifact in DevelopmentArtifact.values) {
+ for (final DevelopmentArtifact artifact in DevelopmentArtifact.values) {
// Don't include unstable artifacts on stable branches.
if (!FlutterVersion.instance.isMaster && artifact.unstable) {
continue;
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index 0fe5581..e428579 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -245,7 +245,7 @@
deviceType = 'multiple';
deviceOsVersion = 'multiple';
isEmulator = false;
- for (Device device in devices) {
+ for (final Device device in devices) {
final TargetPlatform platform = await device.targetPlatform;
anyAndroidDevices = anyAndroidDevices || (platform == TargetPlatform.android);
anyIOSDevices = anyIOSDevices || (platform == TargetPlatform.ios);
@@ -426,7 +426,7 @@
'channel.', null);
}
- for (Device device in devices) {
+ for (final Device device in devices) {
if (!device.supportsFastStart && boolArg('fast-start')) {
globals.printStatus(
'Using --fast-start option with device ${device.name}, but this device '
@@ -456,7 +456,7 @@
}
if (hotMode) {
- for (Device device in devices) {
+ for (final Device device in devices) {
if (!device.supportsHotReload) {
throwToolExit('Hot reload is not supported by ${device.name}. Run with --no-hot.');
}
@@ -470,7 +470,7 @@
}
final FlutterProject flutterProject = FlutterProject.current();
final List<FlutterDevice> flutterDevices = <FlutterDevice>[
- for (Device device in devices)
+ for (final Device device in devices)
await FlutterDevice.create(
device,
flutterProject: flutterProject,
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 21e2e0f..efdaecc 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -222,7 +222,7 @@
if (flutterProject.hasBuilders) {
final CodegenDaemon codegenDaemon = await codeGenerator.daemon(flutterProject);
codegenDaemon.startBuild();
- await for (CodegenStatus status in codegenDaemon.buildResults) {
+ await for (final CodegenStatus status in codegenDaemon.buildResults) {
if (status == CodegenStatus.Succeeded) {
break;
}
@@ -296,7 +296,7 @@
return true;
}
- for (DevFSFileContent entry in entries.values.whereType<DevFSFileContent>()) {
+ for (final DevFSFileContent entry in entries.values.whereType<DevFSFileContent>()) {
// Calling isModified to access file stats first in order for isModifiedAfter
// to work.
if (entry.isModified && entry.isModifiedAfter(lastModified)) {
diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart
index 169e276..b892a4f 100644
--- a/packages/flutter_tools/lib/src/commands/update_packages.dart
+++ b/packages/flutter_tools/lib/src/commands/update_packages.dart
@@ -134,7 +134,7 @@
if (isVerifyOnly) {
bool needsUpdate = false;
globals.printStatus('Verifying pubspecs...');
- for (Directory directory in packages) {
+ for (final Directory directory in packages) {
PubspecYaml pubspec;
try {
pubspec = PubspecYaml(directory);
@@ -153,7 +153,7 @@
}
// all dependencies in the pubspec sorted lexically.
final Map<String, String> checksumDependencies = <String, String>{};
- for (PubspecLine data in pubspec.inputData) {
+ for (final PubspecLine data in pubspec.inputData) {
if (data is PubspecDependency && data.kind == DependencyKind.normal) {
checksumDependencies[data.name] = data.version;
}
@@ -194,7 +194,7 @@
final List<PubspecYaml> pubspecs = <PubspecYaml>[];
final Map<String, PubspecDependency> dependencies = <String, PubspecDependency>{};
final Set<String> specialDependencies = <String>{};
- for (Directory directory in packages) { // these are all the directories with pubspec.yamls we care about
+ for (final Directory directory in packages) { // these are all the directories with pubspec.yamls we care about
globals.printTrace('Reading pubspec.yaml from: ${directory.path}');
PubspecYaml pubspec;
try {
@@ -203,7 +203,7 @@
throwToolExit(message);
}
pubspecs.add(pubspec); // remember it for later
- for (PubspecDependency dependency in pubspec.allDependencies) { // this is all the explicit dependencies
+ for (final PubspecDependency dependency in pubspec.allDependencies) { // this is all the explicit dependencies
if (dependencies.containsKey(dependency.name)) {
// If we've seen the dependency before, make sure that we are
// importing it the same way. There's several ways to import a
@@ -272,13 +272,13 @@
// The transitive dependency tree for the fake package does not contain
// dependencies between Flutter SDK packages and pub packages. We add them
// here.
- for (PubspecYaml pubspec in pubspecs) {
+ for (final PubspecYaml pubspec in pubspecs) {
final String package = pubspec.name;
specialDependencies.add(package);
tree._versions[package] = pubspec.version;
assert(!tree._dependencyTree.containsKey(package));
tree._dependencyTree[package] = <String>{};
- for (PubspecDependency dependency in pubspec.dependencies) {
+ for (final PubspecDependency dependency in pubspec.dependencies) {
if (dependency.kind == DependencyKind.normal) {
tree._dependencyTree[package].add(dependency.name);
}
@@ -305,7 +305,7 @@
// to specific versions because they are explicitly pinned by their
// constraints. Here we list the names we earlier established we didn't
// need to pin because they come from the Dart or Flutter SDKs.
- for (PubspecYaml pubspec in pubspecs) {
+ for (final PubspecYaml pubspec in pubspecs) {
pubspec.apply(tree, specialDependencies);
}
@@ -318,7 +318,7 @@
final Stopwatch timer = Stopwatch()..start();
int count = 0;
- for (Directory dir in packages) {
+ for (final Directory dir in packages) {
await pub.get(context: PubContext.updatePackages, directory: dir.path, checkLastModified: false);
count += 1;
}
@@ -356,7 +356,7 @@
if (link.from != null) {
visited.add(link.from.to);
}
- for (String dependency in tree._dependencyTree[link.to]) {
+ for (final String dependency in tree._dependencyTree[link.to]) {
if (!visited.contains(dependency)) {
traversalQueue.addFirst(_DependencyLink(from: link, to: dependency));
}
@@ -483,7 +483,7 @@
// the dependency. So we track what is the "current" (or "last") dependency
// that we are dealing with using this variable.
PubspecDependency lastDependency;
- for (String line in lines) {
+ for (final String line in lines) {
if (lastDependency == null) {
// First we look to see if we're transitioning to a new top-level section.
// The PubspecHeader.parse static method can recognize those headers.
@@ -614,7 +614,7 @@
// overridden by subsequent entries in the same file and any that have the
// magic comment flagging them as auto-generated transitive dependencies
// that we added in a previous run.
- for (PubspecLine data in inputData) {
+ for (final PubspecLine data in inputData) {
if (data is PubspecDependency && data.kind != DependencyKind.overridden && !data.isTransitive && !data.isDevDependency) {
yield data;
}
@@ -623,7 +623,7 @@
/// This returns all regular dependencies and all dev dependencies.
Iterable<PubspecDependency> get allDependencies sync* {
- for (PubspecLine data in inputData) {
+ for (final PubspecLine data in inputData) {
if (data is PubspecDependency && data.kind != DependencyKind.overridden && !data.isTransitive) {
yield data;
}
@@ -652,7 +652,7 @@
// blank lines, and trailing blank lines, and ensuring the file ends with a
// newline. This cleanup lets us be a little more aggressive while building
// the output.
- for (PubspecLine data in inputData) {
+ for (final PubspecLine data in inputData) {
if (data is PubspecHeader) {
// This line was a header of some sort.
//
@@ -754,10 +754,10 @@
// Create a new set to hold the list of packages we've already processed, so
// that we don't redundantly process them multiple times.
final Set<String> done = <String>{};
- for (String package in directDependencies) {
+ for (final String package in directDependencies) {
transitiveDependencies.addAll(versions.getTransitiveDependenciesFor(package, seen: done, exclude: implied));
}
- for (String package in devDependencies) {
+ for (final String package in devDependencies) {
transitiveDevDependencies.addAll(versions.getTransitiveDependenciesFor(package, seen: done, exclude: implied));
}
@@ -770,10 +770,10 @@
}
// Add a line for each transitive dependency and transitive dev dependency using our magic string to recognize them later.
- for (String package in transitiveDependenciesAsList) {
+ for (final String package in transitiveDependenciesAsList) {
transitiveDependencyOutput.add(computeTransitiveDependencyLineFor(package));
}
- for (String package in transitiveDevDependenciesAsList) {
+ for (final String package in transitiveDevDependenciesAsList) {
transitiveDevDependencyOutput.add(computeTransitiveDependencyLineFor(package));
}
@@ -1148,10 +1148,10 @@
if (_kManuallyPinnedDependencies.isNotEmpty) {
globals.printStatus('WARNING: the following packages use hard-coded version constraints:');
final Set<String> allTransitive = <String>{
- for (PubspecDependency dependency in dependencies)
+ for (final PubspecDependency dependency in dependencies)
dependency.name,
};
- for (String package in _kManuallyPinnedDependencies.keys) {
+ for (final String package in _kManuallyPinnedDependencies.keys) {
// Don't add pinned dependency if it is not in the set of all transitive dependencies.
if (!allTransitive.contains(package)) {
globals.printStatus('Skipping $package because it was not transitive');
@@ -1162,7 +1162,7 @@
globals.printStatus(' - $package: $version');
}
}
- for (PubspecDependency dependency in dependencies) {
+ for (final PubspecDependency dependency in dependencies) {
if (!dependency.pointsToSdk) {
dependency.describeForFakePubspec(result, overrides);
}
@@ -1256,7 +1256,7 @@
// because they were omitted from pubspec.yaml used for 'pub upgrade' run.
return;
}
- for (String dependency in _dependencyTree[package]) {
+ for (final String dependency in _dependencyTree[package]) {
if (!seen.contains(dependency)) {
if (!exclude.contains(dependency)) {
yield dependency;
@@ -1279,7 +1279,7 @@
int lowerCheck = 0;
int upperCheck = 0;
final List<String> sortedNames = names.toList()..sort();
- for (String name in sortedNames) {
+ for (final String name in sortedNames) {
final String version = getVersion(name);
assert(version != '');
if (version == null) {
@@ -1287,7 +1287,7 @@
}
final String value = '$name: $version';
// Each code unit is 16 bits.
- for (int codeUnit in value.codeUnits) {
+ for (final int codeUnit in value.codeUnits) {
final int upper = codeUnit >> 8;
final int lower = codeUnit & 0xFF;
lowerCheck = (lowerCheck + upper) % 255;
diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart
index 30a03bb..af7ce54 100644
--- a/packages/flutter_tools/lib/src/compile.dart
+++ b/packages/flutter_tools/lib/src/compile.dart
@@ -198,7 +198,7 @@
PackageUriMapper(String scriptPath, String packagesPath, String fileSystemScheme, List<String> fileSystemRoots) {
final Map<String, Uri> packageMap = PackageMap(globals.fs.path.absolute(packagesPath)).map;
final String scriptUri = Uri.file(scriptPath, windows: globals.platform.isWindows).toString();
- for (String packageName in packageMap.keys) {
+ for (final String packageName in packageMap.keys) {
final String prefix = packageMap[packageName].toString();
// Only perform a multi-root mapping if there are multiple roots.
if (fileSystemScheme != null
@@ -227,7 +227,7 @@
return null;
}
final String scriptUri = Uri.file(scriptPath, windows: globals.platform.isWindows).toString();
- for (String uriPrefix in _uriPrefixes) {
+ for (final String uriPrefix in _uriPrefixes) {
if (scriptUri.startsWith(uriPrefix)) {
return Uri.parse('package:$_packageName/${scriptUri.substring(uriPrefix.length)}');
}
@@ -314,7 +314,7 @@
sdkRoot,
'--target=$targetModel',
'-Ddart.developer.causal_async_stacks=$causalAsyncStacks',
- for (Object dartDefine in dartDefines)
+ for (final Object dartDefine in dartDefines)
'-D$dartDefine',
..._buildModeOptions(buildMode),
if (trackWidgetCreation) '--track-widget-creation',
@@ -336,7 +336,7 @@
depFilePath,
],
if (fileSystemRoots != null)
- for (String root in fileSystemRoots) ...<String>[
+ for (final String root in fileSystemRoots) ...<String>[
'--filesystem-root',
root,
],
@@ -608,7 +608,7 @@
: '';
_server.stdin.writeln('recompile $mainUri$inputKey');
globals.printTrace('<- recompile $mainUri$inputKey');
- for (Uri fileUri in request.invalidatedFiles) {
+ for (final Uri fileUri in request.invalidatedFiles) {
_server.stdin.writeln(_mapFileUri(fileUri.toString(), packageUriMapper));
globals.printTrace('${_mapFileUri(fileUri.toString(), packageUriMapper)}');
}
@@ -651,7 +651,7 @@
'--incremental',
'--target=$targetModel',
'-Ddart.developer.causal_async_stacks=$causalAsyncStacks',
- for (Object dartDefine in dartDefines)
+ for (final Object dartDefine in dartDefines)
'-D$dartDefine',
if (outputPath != null) ...<String>[
'--output-dill',
@@ -667,7 +667,7 @@
..._buildModeOptions(buildMode),
if (trackWidgetCreation) '--track-widget-creation',
if (fileSystemRoots != null)
- for (String root in fileSystemRoots) ...<String>[
+ for (final String root in fileSystemRoots) ...<String>[
'--filesystem-root',
root,
],
@@ -824,7 +824,7 @@
}
if (fileSystemRoots != null) {
- for (String root in fileSystemRoots) {
+ for (final String root in fileSystemRoots) {
if (filename.startsWith(root)) {
return Uri(
scheme: fileSystemScheme, path: filename.substring(root.length))
diff --git a/packages/flutter_tools/lib/src/dart/pub.dart b/packages/flutter_tools/lib/src/dart/pub.dart
index 375fdd3..a2a5c4e 100644
--- a/packages/flutter_tools/lib/src/dart/pub.dart
+++ b/packages/flutter_tools/lib/src/dart/pub.dart
@@ -29,7 +29,7 @@
// We have server-side tooling that assumes the values are consistent.
class PubContext {
PubContext._(this._values) {
- for (String item in _values) {
+ for (final String item in _values) {
if (!_validContext.hasMatch(item)) {
throw ArgumentError.value(
_values, 'value', 'Must match RegExp ${_validContext.pattern}');
diff --git a/packages/flutter_tools/lib/src/desktop_device.dart b/packages/flutter_tools/lib/src/desktop_device.dart
index 0922824..65a2339 100644
--- a/packages/flutter_tools/lib/src/desktop_device.dart
+++ b/packages/flutter_tools/lib/src/desktop_device.dart
@@ -130,7 +130,7 @@
bool succeeded = true;
// Walk a copy of _runningProcesses, since the exit handler removes from the
// set.
- for (Process process in Set<Process>.from(_runningProcesses)) {
+ for (final Process process in Set<Process>.from(_runningProcesses)) {
succeeded &= process.kill();
}
return succeeded;
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart
index d7ac151..9109845 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -118,7 +118,7 @@
}
// Match on a id or name starting with [deviceId].
- for (Device device in devices.where(startsWithDeviceId)) {
+ for (final Device device in devices.where(startsWithDeviceId)) {
yield device;
}
}
@@ -136,8 +136,8 @@
/// Return the list of all connected devices.
Stream<Device> getAllConnectedDevices() async* {
- for (DeviceDiscovery discoverer in _platformDiscoverers) {
- for (Device device in await discoverer.devices) {
+ for (final DeviceDiscovery discoverer in _platformDiscoverers) {
+ for (final Device device in await discoverer.devices) {
yield device;
}
}
@@ -151,7 +151,7 @@
/// Get diagnostics about issues with any connected devices.
Future<List<String>> getDeviceDiagnostics() async {
return <String>[
- for (DeviceDiscovery discoverer in _platformDiscoverers)
+ for (final DeviceDiscovery discoverer in _platformDiscoverers)
...await discoverer.getDiagnostics(),
];
}
@@ -178,7 +178,7 @@
// compilers, and web requires an entirely different resident runner.
if (hasSpecifiedAllDevices) {
devices = <Device>[
- for (Device device in devices)
+ for (final Device device in devices)
if (await device.targetPlatform != TargetPlatform.fuchsia_arm64 &&
await device.targetPlatform != TargetPlatform.fuchsia_x64 &&
await device.targetPlatform != TargetPlatform.web_javascript)
@@ -191,7 +191,7 @@
// 'android' folder then don't attempt to launch with an Android device.
if (devices.length > 1 && !hasSpecifiedDeviceId) {
devices = <Device>[
- for (Device device in devices)
+ for (final Device device in devices)
if (isDeviceSupportedForProject(device, flutterProject))
device,
];
@@ -460,7 +460,7 @@
// Extract device information
final List<List<String>> table = <List<String>>[];
- for (Device device in devices) {
+ for (final Device device in devices) {
String supportIndicator = device.isSupported() ? '' : ' (unsupported)';
final TargetPlatform targetPlatform = await device.targetPlatform;
if (await device.isLocalEmulator) {
@@ -478,12 +478,12 @@
// Calculate column widths
final List<int> indices = List<int>.generate(table[0].length - 1, (int i) => i);
List<int> widths = indices.map<int>((int i) => 0).toList();
- for (List<String> row in table) {
+ for (final List<String> row in table) {
widths = indices.map<int>((int i) => math.max(widths[i], row[i].length)).toList();
}
// Join columns into lines of text
- for (List<String> row in table) {
+ for (final List<String> row in table) {
yield indices.map<String>((int i) => row[i].padRight(widths[i])).join(' • ') + ' • ${row.last}';
}
}
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index ccaf690..366e2f1 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -147,7 +147,7 @@
/// Return a list of [ValidatorTask] objects and starts validation on all
/// objects in [validators].
List<ValidatorTask> startValidatorTasks() => <ValidatorTask>[
- for (DoctorValidator validator in validators)
+ for (final DoctorValidator validator in validators)
ValidatorTask(
validator,
// We use an asyncGuard() here to be absolutely certain that
@@ -178,7 +178,7 @@
bool missingComponent = false;
bool sawACrash = false;
- for (DoctorValidator validator in validators) {
+ for (final DoctorValidator validator in validators) {
final StringBuffer lineBuffer = StringBuffer();
ValidationResult result;
try {
@@ -248,7 +248,7 @@
bool doctorResult = true;
int issues = 0;
- for (ValidatorTask validatorTask in startValidatorTasks()) {
+ for (final ValidatorTask validatorTask in startValidatorTasks()) {
final DoctorValidator validator = validatorTask.validator;
final Status status = Status.withSpinner(
timeout: timeoutConfiguration.fastOperation,
@@ -291,12 +291,12 @@
hangingIndent: result.leadingBox.length + 1);
}
- for (ValidationMessage message in result.messages) {
+ for (final ValidationMessage message in result.messages) {
if (message.type != ValidationMessageType.information || verbose == true) {
int hangingIndent = 2;
int indent = 4;
final String indicator = showColor ? message.coloredIndicator : message.indicator;
- for (String line in '$indicator ${message.message}'.split('\n')) {
+ for (final String line in '$indicator ${message.message}'.split('\n')) {
globals.printStatus(line, hangingIndent: hangingIndent, indent: indent, emphasis: true);
// Only do hanging indent for the first line.
hangingIndent = 0;
@@ -402,7 +402,7 @@
@override
Future<ValidationResult> validate() async {
final List<ValidatorTask> tasks = <ValidatorTask>[
- for (DoctorValidator validator in subValidators)
+ for (final DoctorValidator validator in subValidators)
ValidatorTask(
validator,
asyncGuard<ValidationResult>(() => validator.validate()),
@@ -410,7 +410,7 @@
];
final List<ValidationResult> results = <ValidationResult>[];
- for (ValidatorTask subValidator in tasks) {
+ for (final ValidatorTask subValidator in tasks) {
_currentSlowWarning = subValidator.validator.slowWarning;
try {
results.add(await subValidator.result);
@@ -429,7 +429,7 @@
final List<ValidationMessage> mergedMessages = <ValidationMessage>[];
String statusInfo;
- for (ValidationResult result in results) {
+ for (final ValidationResult result in results) {
statusInfo ??= result.statusInfo;
switch (result.type) {
case ValidationType.installed:
@@ -753,7 +753,7 @@
validators.add(validator);
}
- for (FileSystemEntity dir in globals.fs.directory(homeDirPath).listSync()) {
+ for (final FileSystemEntity dir in globals.fs.directory(homeDirPath).listSync()) {
if (dir is Directory) {
final String name = globals.fs.path.basename(dir.path);
IntelliJValidator._idToTitle.forEach((String id, String title) {
@@ -808,10 +808,10 @@
.map<List<FileSystemEntity>>((Directory dir) => dir.existsSync() ? dir.listSync() : <FileSystemEntity>[])
.expand<FileSystemEntity>((List<FileSystemEntity> mappedDirs) => mappedDirs)
.whereType<Directory>();
- for (Directory dir in installDirs) {
+ for (final Directory dir in installDirs) {
checkForIntelliJ(dir);
if (!dir.path.endsWith('.app')) {
- for (FileSystemEntity subdir in dir.listSync()) {
+ for (final FileSystemEntity subdir in dir.listSync()) {
if (subdir is Directory) {
checkForIntelliJ(subdir);
}
diff --git a/packages/flutter_tools/lib/src/emulator.dart b/packages/flutter_tools/lib/src/emulator.dart
index d29f281..3cfcac6 100644
--- a/packages/flutter_tools/lib/src/emulator.dart
+++ b/packages/flutter_tools/lib/src/emulator.dart
@@ -250,7 +250,7 @@
// Extract emulators information
final List<List<String>> table = <List<String>>[
- for (Emulator emulator in emulators)
+ for (final Emulator emulator in emulators)
<String>[
emulator.id ?? '',
emulator.name ?? '',
@@ -262,7 +262,7 @@
// Calculate column widths
final List<int> indices = List<int>.generate(table[0].length - 1, (int i) => i);
List<int> widths = indices.map<int>((int i) => 0).toList();
- for (List<String> row in table) {
+ for (final List<String> row in table) {
widths = indices.map<int>((int i) => math.max(widths[i], row[i].length)).toList();
}
diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart
index f3351a3..36c25ef 100644
--- a/packages/flutter_tools/lib/src/flutter_manifest.dart
+++ b/packages/flutter_tools/lib/src/flutter_manifest.dart
@@ -197,7 +197,7 @@
return const <Uri>[];
}
final List<Uri> results = <Uri>[];
- for (Object asset in assets) {
+ for (final Object asset in assets) {
if (asset is! String || asset == null || asset == '') {
globals.printError('Asset manifest contains a null or empty uri.');
continue;
@@ -225,7 +225,7 @@
}
final List<Font> fonts = <Font>[];
- for (Map<String, dynamic> fontFamily in _rawFontsDescriptor) {
+ for (final Map<String, dynamic> fontFamily in _rawFontsDescriptor) {
final YamlList fontFiles = fontFamily['fonts'] as YamlList;
final String familyName = fontFamily['family'] as String;
if (familyName == null) {
@@ -238,7 +238,7 @@
}
final List<FontAsset> fontAssets = <FontAsset>[];
- for (Map<dynamic, dynamic> fontFile in fontFiles.cast<Map<dynamic, dynamic>>()) {
+ for (final Map<dynamic, dynamic> fontFile in fontFiles.cast<Map<dynamic, dynamic>>()) {
final String asset = fontFile['asset'] as String;
if (asset == null) {
globals.printError('Warning: Missing asset in fonts for $familyName', emphasis: true);
@@ -431,7 +431,7 @@
continue;
}
final YamlMap fontMap = fontListEntry as YamlMap;
- for (dynamic key in fontMap.keys.where((dynamic key) => key != 'family' && key != 'fonts')) {
+ for (final dynamic key in fontMap.keys.where((dynamic key) => key != 'family' && key != 'fonts')) {
errors.add('Unexpected child "$key" found under "fonts".');
}
if (fontMap['family'] != null && fontMap['family'] is! String) {
diff --git a/packages/flutter_tools/lib/src/fuchsia/fuchsia_build.dart b/packages/flutter_tools/lib/src/fuchsia/fuchsia_build.dart
index 24f1419..9ccc04c 100644
--- a/packages/flutter_tools/lib/src/fuchsia/fuchsia_build.dart
+++ b/packages/flutter_tools/lib/src/fuchsia/fuchsia_build.dart
@@ -148,7 +148,7 @@
await destFile.create(recursive: true);
final IOSink outFile = destFile.openWrite();
- for (String path in assets.entries.keys) {
+ for (final String path in assets.entries.keys) {
outFile.write('data/$appName/$path=$assetDir/$path\n');
}
await outFile.flush();
diff --git a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
index 5ae5a89..21e1fbe 100644
--- a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+++ b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
@@ -164,7 +164,7 @@
@visibleForTesting
List<FuchsiaDevice> parseListDevices(String text) {
final List<FuchsiaDevice> devices = <FuchsiaDevice>[];
- for (String rawLine in text.trim().split('\n')) {
+ for (final String rawLine in text.trim().split('\n')) {
final String line = rawLine.trim();
// ['ip', 'device name']
final List<String> words = line.split(' ');
@@ -501,7 +501,7 @@
return null;
}
final List<int> ports = <int>[];
- for (String path in findOutput.split('\n')) {
+ for (final String path in findOutput.split('\n')) {
if (path == '') {
continue;
}
@@ -512,7 +512,7 @@
return null;
}
final String lsOutput = lsResult.stdout;
- for (String line in lsOutput.split('\n')) {
+ for (final String line in lsOutput.split('\n')) {
if (line == '') {
continue;
}
@@ -557,7 +557,7 @@
// TODO(jonahwilliams): replacing this with the hub will require an update
// to the flutter_runner.
Future<int> findIsolatePort(String isolateName, List<int> ports) async {
- for (int port in ports) {
+ for (final int port in ports) {
try {
// Note: The square-bracket enclosure for using the IPv6 loopback
// didn't appear to work, but when assigning to the IPv4 loopback device,
@@ -567,7 +567,7 @@
final VMService vmService = await VMService.connect(uri);
await vmService.getVM();
await vmService.refreshViews();
- for (FlutterView flutterView in vmService.vm.views) {
+ for (final FlutterView flutterView in vmService.vm.views) {
if (flutterView.uiIsolate == null) {
continue;
}
@@ -647,7 +647,7 @@
Future<void> _findIsolate() async {
final List<int> ports = await _device.servicePorts();
- for (int port in ports) {
+ for (final int port in ports) {
VMService service;
if (_ports.containsKey(port)) {
service = _ports[port];
@@ -664,7 +664,7 @@
}
await service.getVM();
await service.refreshViews();
- for (FlutterView flutterView in service.vm.views) {
+ for (final FlutterView flutterView in service.vm.views) {
if (flutterView.uiIsolate == null) {
continue;
}
@@ -753,7 +753,7 @@
@override
Future<void> dispose() async {
- for (ForwardedPort port in forwardedPorts) {
+ for (final ForwardedPort port in forwardedPorts) {
await unforward(port);
}
}
diff --git a/packages/flutter_tools/lib/src/fuchsia/tiles_ctl.dart b/packages/flutter_tools/lib/src/fuchsia/tiles_ctl.dart
index 5357a9f..21ab56f 100644
--- a/packages/flutter_tools/lib/src/fuchsia/tiles_ctl.dart
+++ b/packages/flutter_tools/lib/src/fuchsia/tiles_ctl.dart
@@ -26,7 +26,7 @@
globals.printTrace('tiles_ctl is not running');
return -1;
}
- for (MapEntry<int, String> entry in runningApps.entries) {
+ for (final MapEntry<int, String> entry in runningApps.entries) {
if (entry.value.contains('$appName#meta')) {
return entry.key;
}
@@ -70,7 +70,7 @@
return null;
}
// Find lines beginning with 'Tile'
- for (String line in result.stdout.split('\n')) {
+ for (final String line in result.stdout.split('\n')) {
final List<String> words = line.split(' ');
if (words.isNotEmpty && words[0] == 'Tile') {
final int key = int.tryParse(words[2]);
diff --git a/packages/flutter_tools/lib/src/intellij/intellij.dart b/packages/flutter_tools/lib/src/intellij/intellij.dart
index aa2fd20..48a9a50 100644
--- a/packages/flutter_tools/lib/src/intellij/intellij.dart
+++ b/packages/flutter_tools/lib/src/intellij/intellij.dart
@@ -22,7 +22,7 @@
String title, {
Version minVersion,
}) {
- for (String packageName in packageNames) {
+ for (final String packageName in packageNames) {
if (!_hasPackage(packageName)) {
continue;
}
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index 5b5fd27..c9b4341 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -660,7 +660,7 @@
@override
void dispose() {
- for (StreamSubscription<ServiceEvent> loggingSubscription in _loggingSubscriptions) {
+ for (final StreamSubscription<ServiceEvent> loggingSubscription in _loggingSubscriptions) {
loggingSubscription.cancel();
}
_idevicesyslogProcess?.kill();
@@ -747,7 +747,7 @@
@override
Future<void> dispose() async {
- for (ForwardedPort forwardedPort in _forwardedPorts) {
+ for (final ForwardedPort forwardedPort in _forwardedPorts) {
forwardedPort.dispose();
}
}
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 7974313..a220b42 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -371,7 +371,7 @@
}
if (autoSigningConfigs != null) {
- for (MapEntry<String, String> signingConfig in autoSigningConfigs.entries) {
+ for (final MapEntry<String, String> signingConfig in autoSigningConfigs.entries) {
buildCommands.add('${signingConfig.key}=${signingConfig.value}');
}
buildCommands.add('-allowProvisioningUpdates');
@@ -379,7 +379,7 @@
}
final List<FileSystemEntity> contents = app.project.hostAppRoot.listSync();
- for (FileSystemEntity entity in contents) {
+ for (final FileSystemEntity entity in contents) {
if (globals.fs.path.extension(entity.path) == '.xcworkspace') {
buildCommands.addAll(<String>[
'-workspace', globals.fs.path.basename(entity.path),
@@ -426,7 +426,7 @@
Future<void> listenToScriptOutputLine() async {
final List<String> lines = await scriptOutputPipeFile.readAsLines();
- for (String line in lines) {
+ for (final String line in lines) {
if (line == 'done' || line == 'all done') {
buildSubStatus?.stop();
buildSubStatus = null;
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 748d1dc..72b7aa6 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -112,10 +112,10 @@
final Map<String, dynamic> devicesSection = await _list(SimControlListSection.devices);
- for (String deviceCategory in devicesSection.keys) {
+ for (final String deviceCategory in devicesSection.keys) {
final Object devicesData = devicesSection[deviceCategory];
if (devicesData != null && devicesData is List<dynamic>) {
- for (Map<String, dynamic> data in devicesData.map<Map<String, dynamic>>(castStringKeyedMap)) {
+ for (final Map<String, dynamic> data in devicesData.map<Map<String, dynamic>>(castStringKeyedMap)) {
devices.add(SimDevice(deviceCategory, data));
}
}
@@ -809,7 +809,7 @@
@override
Future<void> dispose() async {
- for (ForwardedPort port in _ports) {
+ for (final ForwardedPort port in _ports) {
await unforward(port);
}
}
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
index ff966cb..09b50ca 100644
--- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart
+++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -106,7 +106,7 @@
localsBuffer.writeln('#!/bin/sh');
localsBuffer.writeln('# This is a generated file; do not edit or check into version control.');
- for (String line in xcodeBuildSettings) {
+ for (final String line in xcodeBuildSettings) {
localsBuffer.writeln('export "$line"');
}
@@ -372,7 +372,7 @@
Map<String, String> parseXcodeBuildSettings(String showBuildSettingsOutput) {
final Map<String, String> settings = <String, String>{};
- for (Match match in showBuildSettingsOutput.split('\n').map<Match>(_settingExpr.firstMatch)) {
+ for (final Match match in showBuildSettingsOutput.split('\n').map<Match>(_settingExpr.firstMatch)) {
if (match != null) {
settings[match[1]] = match[2];
}
@@ -402,7 +402,7 @@
final List<String> buildConfigurations = <String>[];
final List<String> schemes = <String>[];
List<String> collector;
- for (String line in output.split('\n')) {
+ for (final String line in output.split('\n')) {
if (line.isEmpty) {
collector = null;
continue;
@@ -454,7 +454,7 @@
/// regard to case.
bool hasBuildConfiguratinForBuildMode(String buildMode) {
buildMode = buildMode.toLowerCase();
- for (String name in buildConfigurations) {
+ for (final String name in buildConfigurations) {
if (name.toLowerCase() == buildMode) {
return true;
}
diff --git a/packages/flutter_tools/lib/src/linux/makefile.dart b/packages/flutter_tools/lib/src/linux/makefile.dart
index 3569082..94331ac 100644
--- a/packages/flutter_tools/lib/src/linux/makefile.dart
+++ b/packages/flutter_tools/lib/src/linux/makefile.dart
@@ -11,7 +11,7 @@
///
/// Returns `null` if it cannot be found.
String makefileExecutableName(LinuxProject project) {
- for (String line in project.makeFile.readAsLinesSync()) {
+ for (final String line in project.makeFile.readAsLinesSync()) {
if (line.startsWith(_kBinaryNameVariable)) {
return line.split(_kBinaryNameVariable).last.trim();
}
diff --git a/packages/flutter_tools/lib/src/mdns_discovery.dart b/packages/flutter_tools/lib/src/mdns_discovery.dart
index 033e097..dea4976 100644
--- a/packages/flutter_tools/lib/src/mdns_discovery.dart
+++ b/packages/flutter_tools/lib/src/mdns_discovery.dart
@@ -75,7 +75,7 @@
String domainName;
if (applicationId != null) {
- for (String name in uniqueDomainNames) {
+ for (final String name in uniqueDomainNames) {
if (name.toLowerCase().startsWith(applicationId.toLowerCase())) {
domainName = name;
break;
@@ -206,10 +206,10 @@
}
void _logInterfaces(List<NetworkInterface> interfaces) {
- for (NetworkInterface interface in interfaces) {
+ for (final NetworkInterface interface in interfaces) {
if (globals.logger.isVerbose) {
globals.printTrace('Found interface "${interface.name}":');
- for (InternetAddress address in interface.addresses) {
+ for (final InternetAddress address in interface.addresses) {
final String linkLocal = address.isLinkLocal ? 'link local' : '';
globals.printTrace('\tBound address: "${address.address}" $linkLocal');
}
diff --git a/packages/flutter_tools/lib/src/plugins.dart b/packages/flutter_tools/lib/src/plugins.dart
index 22f506b..cd7eb43 100644
--- a/packages/flutter_tools/lib/src/plugins.dart
+++ b/packages/flutter_tools/lib/src/plugins.dart
@@ -321,10 +321,10 @@
final StringBuffer flutterPluginsBuffer = StringBuffer('# $info\n');
final Set<String> pluginNames = <String>{};
- for (Plugin plugin in plugins) {
+ for (final Plugin plugin in plugins) {
pluginNames.add(plugin.name);
}
- for (Plugin plugin in plugins) {
+ for (final Plugin plugin in plugins) {
flutterPluginsBuffer.write('${plugin.name}=${escapePath(plugin.path)}\n');
directAppDependencies.add(<String, dynamic>{
'name': plugin.name,
@@ -439,7 +439,7 @@
List<Map<String, dynamic>> _extractPlatformMaps(List<Plugin> plugins, String type) {
final List<Map<String, dynamic>> pluginConfigs = <Map<String, dynamic>>[];
- for (Plugin p in plugins) {
+ for (final Plugin p in plugins) {
final PluginPlatform platformPlugin = p.platforms[type];
if (platformPlugin != null) {
pluginConfigs.add(platformPlugin.toMap());
@@ -484,7 +484,7 @@
templateContext['needsShim'] = false;
// If a plugin is using an embedding version older than 2.0 and the app is using 2.0,
// then add shim for the old plugins.
- for (Map<String, dynamic> plugin in androidPlugins) {
+ for (final Map<String, dynamic> plugin in androidPlugins) {
if (plugin['supportsEmbeddingV1'] as bool && !(plugin['supportsEmbeddingV2'] as bool)) {
templateContext['needsShim'] = true;
if (project.isModule) {
@@ -504,7 +504,7 @@
break;
case AndroidEmbeddingVersion.v1:
default:
- for (Map<String, dynamic> plugin in androidPlugins) {
+ for (final Map<String, dynamic> plugin in androidPlugins) {
if (!(plugin['supportsEmbeddingV1'] as bool) && plugin['supportsEmbeddingV2'] as bool) {
throwToolExit(
'The plugin `${plugin['name']}` requires your app to be migrated to '
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart
index 234a266..6d14011 100644
--- a/packages/flutter_tools/lib/src/project.dart
+++ b/packages/flutter_tools/lib/src/project.dart
@@ -699,7 +699,7 @@
throwToolExit('Error reading $appManifestFile even though it exists. '
'Please ensure that you have read permission to this file and try again.');
}
- for (xml.XmlElement metaData in document.findAllElements('meta-data')) {
+ for (final xml.XmlElement metaData in document.findAllElements('meta-data')) {
final String name = metaData.getAttribute('android:name');
if (name == 'flutterEmbedding') {
final String embeddingVersionString = metaData.getAttribute('android:value');
@@ -764,7 +764,7 @@
if (!file.existsSync()) {
return null;
}
- for (String line in file.readAsLinesSync()) {
+ for (final String line in file.readAsLinesSync()) {
final Match match = regExp.firstMatch(line);
if (match != null) {
return match;
diff --git a/packages/flutter_tools/lib/src/protocol_discovery.dart b/packages/flutter_tools/lib/src/protocol_discovery.dart
index 6133048..a13878e 100644
--- a/packages/flutter_tools/lib/src/protocol_discovery.dart
+++ b/packages/flutter_tools/lib/src/protocol_discovery.dart
@@ -157,7 +157,7 @@
StreamController<T> get _streamController {
_streamControllerInstance ??= StreamController<T>.broadcast(onListen: () {
- for (dynamic event in _events) {
+ for (final dynamic event in _events) {
assert(T is! List);
if (event is T) {
_streamControllerInstance.add(event);
diff --git a/packages/flutter_tools/lib/src/proxy_validator.dart b/packages/flutter_tools/lib/src/proxy_validator.dart
index 3a8931e..95896f2 100644
--- a/packages/flutter_tools/lib/src/proxy_validator.dart
+++ b/packages/flutter_tools/lib/src/proxy_validator.dart
@@ -34,7 +34,7 @@
messages.add(ValidationMessage.hint('NO_PROXY is not set'));
} else {
messages.add(ValidationMessage('NO_PROXY is $_noProxy'));
- for (String host in const <String>['127.0.0.1', 'localhost']) {
+ for (final String host in const <String>['127.0.0.1', 'localhost']) {
final ValidationMessage msg = _noProxy.contains(host)
? ValidationMessage('NO_PROXY contains $host')
: ValidationMessage.hint('NO_PROXY does not contain $host');
diff --git a/packages/flutter_tools/lib/src/reporting/github_template.dart b/packages/flutter_tools/lib/src/reporting/github_template.dart
index 367232e..ff35e3b 100644
--- a/packages/flutter_tools/lib/src/reporting/github_template.dart
+++ b/packages/flutter_tools/lib/src/reporting/github_template.dart
@@ -99,7 +99,7 @@
description.writeln('### Plugins');
// Format is:
// camera=/path/to/.pub-cache/hosted/pub.dartlang.org/camera-0.5.7+2/
- for (String plugin in project.flutterPluginsFile.readAsLinesSync()) {
+ for (final String plugin in project.flutterPluginsFile.readAsLinesSync()) {
final List<String> pluginParts = plugin.split('=');
if (pluginParts.length != 2) {
continue;
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 15e4b03..9e46694 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -249,7 +249,7 @@
return;
}
final List<Future<void>> futures = <Future<void>>[];
- for (FlutterView view in flutterViews) {
+ for (final FlutterView view in flutterViews) {
if (view != null && view.uiIsolate != null) {
assert(!view.uiIsolate.pauseEvent.isPauseEvent);
futures.add(view.uiIsolate.flutterExit());
@@ -283,7 +283,7 @@
final Uri deviceEntryUri = devFS.baseUri.resolveUri(globals.fs.path.toUri(entryPath));
final Uri devicePackagesUri = devFS.baseUri.resolve('.packages');
return <Future<Map<String, dynamic>>>[
- for (FlutterView view in views)
+ for (final FlutterView view in views)
view.uiIsolate.reloadSources(
pause: pause,
rootLibUri: deviceEntryUri,
@@ -302,68 +302,68 @@
}
Future<void> debugDumpApp() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterDebugDumpApp();
}
}
Future<void> debugDumpRenderTree() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterDebugDumpRenderTree();
}
}
Future<void> debugDumpLayerTree() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterDebugDumpLayerTree();
}
}
Future<void> debugDumpSemanticsTreeInTraversalOrder() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterDebugDumpSemanticsTreeInTraversalOrder();
}
}
Future<void> debugDumpSemanticsTreeInInverseHitTestOrder() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterDebugDumpSemanticsTreeInInverseHitTestOrder();
}
}
Future<void> toggleDebugPaintSizeEnabled() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterToggleDebugPaintSizeEnabled();
}
}
Future<void> toggleDebugCheckElevationsEnabled() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterToggleDebugCheckElevationsEnabled();
}
}
Future<void> debugTogglePerformanceOverlayOverride() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterTogglePerformanceOverlayOverride();
}
}
Future<void> toggleWidgetInspector() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterToggleWidgetInspector();
}
}
Future<void> toggleProfileWidgetBuilds() async {
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterToggleProfileWidgetBuilds();
}
}
Future<String> togglePlatform({ String from }) async {
final String to = nextPlatform(from, featureFlags);
- for (FlutterView view in views) {
+ for (final FlutterView view in views) {
await view.uiIsolate.flutterPlatformOverride(to);
}
return to;
@@ -578,7 +578,7 @@
/// Returns `true` if any of the devices is running Android Q.
Future<bool> hasDeviceRunningAndroidQ(List<FlutterDevice> flutterDevices) async {
- for (FlutterDevice flutterDevice in flutterDevices) {
+ for (final FlutterDevice flutterDevice in flutterDevices) {
final String sdkNameAndVersion = await flutterDevice.device.sdkNameAndVersion;
if (sdkNameAndVersion != null && sdkNameAndVersion.startsWith('Android 10')) {
return true;
@@ -755,77 +755,77 @@
Future<void> refreshViews() async {
final List<Future<void>> futures = <Future<void>>[
- for (FlutterDevice device in flutterDevices) device.refreshViews(),
+ for (final FlutterDevice device in flutterDevices) device.refreshViews(),
];
await Future.wait(futures);
}
Future<void> debugDumpApp() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.debugDumpApp();
}
}
Future<void> debugDumpRenderTree() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.debugDumpRenderTree();
}
}
Future<void> debugDumpLayerTree() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.debugDumpLayerTree();
}
}
Future<void> debugDumpSemanticsTreeInTraversalOrder() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.debugDumpSemanticsTreeInTraversalOrder();
}
}
Future<void> debugDumpSemanticsTreeInInverseHitTestOrder() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.debugDumpSemanticsTreeInInverseHitTestOrder();
}
}
Future<void> debugToggleDebugPaintSizeEnabled() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.toggleDebugPaintSizeEnabled();
}
}
Future<void> debugToggleDebugCheckElevationsEnabled() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.toggleDebugCheckElevationsEnabled();
}
}
Future<void> debugTogglePerformanceOverlayOverride() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.debugTogglePerformanceOverlayOverride();
}
}
Future<void> debugToggleWidgetInspector() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.toggleWidgetInspector();
}
}
Future<void> debugToggleProfileWidgetBuilds() async {
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.toggleProfileWidgetBuilds();
}
}
@@ -845,7 +845,7 @@
if (supportsServiceProtocol && isRunningDebug) {
await device.refreshViews();
try {
- for (FlutterView view in device.views) {
+ for (final FlutterView view in device.views) {
await view.uiIsolate.flutterDebugAllowBanner(false);
}
} catch (error) {
@@ -859,7 +859,7 @@
} finally {
if (supportsServiceProtocol && isRunningDebug) {
try {
- for (FlutterView view in device.views) {
+ for (final FlutterView view in device.views) {
await view.uiIsolate.flutterDebugAllowBanner(true);
}
} catch (error) {
@@ -882,7 +882,7 @@
await refreshViews();
final String from = await flutterDevices[0].views[0].uiIsolate.flutterPlatformOverride();
String to;
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
to = await device.togglePlatform(from: from);
}
globals.printStatus('Switched operating system to $to');
@@ -913,7 +913,7 @@
_finished = Completer<int>();
bool viewFound = false;
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
await device.connect(
reloadSources: reloadSources,
restart: restart,
@@ -935,7 +935,7 @@
}
// Listen for service protocol connection to close.
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
// This hooks up callbacks for when the connection stops in the future.
// We don't want to wait for them. We don't handle errors in those callbacks'
// futures either because they just print to logger and is not critical.
@@ -993,7 +993,7 @@
Future<void> exitApp() async {
final List<Future<void>> futures = <Future<void>>[
- for (FlutterDevice device in flutterDevices) device.exitApps(),
+ for (final FlutterDevice device in flutterDevices) device.exitApps(),
];
await Future.wait(futures);
appFinished();
@@ -1116,7 +1116,7 @@
/// Unregisters terminal signal and keystroke handlers.
void stop() {
assert(residentRunner.stayResident);
- for (MapEntry<io.ProcessSignal, Object> entry in _signalTokens.entries) {
+ for (final MapEntry<io.ProcessSignal, Object> entry in _signalTokens.entries) {
signals.removeHandler(entry.key, entry.value);
}
_signalTokens.clear();
@@ -1154,7 +1154,7 @@
final List<FlutterView> views = residentRunner.flutterDevices
.expand((FlutterDevice d) => d.views).toList();
globals.printStatus('Connected ${pluralize('view', views.length)}:');
- for (FlutterView v in views) {
+ for (final FlutterView v in views) {
globals.printStatus('${v.uiIsolate.name} (${v.uiIsolate.id})', indent: 2);
}
return true;
@@ -1189,7 +1189,7 @@
await residentRunner.exit();
return true;
case 's':
- for (FlutterDevice device in residentRunner.flutterDevices) {
+ for (final FlutterDevice device in residentRunner.flutterDevices) {
if (device.device.supportsScreenshot) {
await residentRunner.screenshot(device);
}
diff --git a/packages/flutter_tools/lib/src/run_cold.dart b/packages/flutter_tools/lib/src/run_cold.dart
index 02f95ae..1211452 100644
--- a/packages/flutter_tools/lib/src/run_cold.dart
+++ b/packages/flutter_tools/lib/src/run_cold.dart
@@ -60,7 +60,7 @@
}
}
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
final int result = await device.runCold(
coldRunner: this,
route: route,
@@ -90,7 +90,7 @@
globals.printTrace('Application running.');
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
if (device.vmService == null) {
continue;
}
@@ -142,12 +142,12 @@
}
return 2;
}
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
device.initLogReader();
}
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
globals.printTrace('Connected to $view.');
}
}
@@ -170,7 +170,7 @@
@override
Future<void> cleanupAtFinish() async {
- for (FlutterDevice flutterDevice in flutterDevices) {
+ for (final FlutterDevice flutterDevice in flutterDevices) {
await flutterDevice.device.dispose();
}
@@ -181,7 +181,7 @@
void printHelp({ @required bool details }) {
bool haveDetails = false;
bool haveAnything = false;
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
final String dname = device.device.name;
if (device.vmService != null) {
globals.printStatus('An Observatory debugger and profiler on $dname is '
@@ -209,7 +209,7 @@
@override
Future<void> preExit() async {
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
// If we're running in release mode, stop the app using the device logic.
if (device.vmService == null) {
await device.device.stopApp(device.package);
diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart
index e8d9337..2eadea5 100644
--- a/packages/flutter_tools/lib/src/run_hot.dart
+++ b/packages/flutter_tools/lib/src/run_hot.dart
@@ -137,7 +137,7 @@
String klass,
bool isStatic,
) async {
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
if (device.generator != null) {
final CompilerOutput compilerOutput =
await device.generator.compileExpression(expression, definitions,
@@ -155,7 +155,7 @@
final Stopwatch stopwatch = Stopwatch()..start();
final UpdateFSReport results = UpdateFSReport(success: true);
final List<Uri> invalidated = <Uri>[Uri.parse(libraryId)];
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
results.incorporateResults(await device.updateDevFS(
mainPath: mainPath,
target: target,
@@ -178,7 +178,7 @@
getReloadPath(fullRestart: false),
from: projectRootPath,
);
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
final List<Future<Map<String, dynamic>>> reportFutures = device.reloadSources(
entryPath, pause: false,
);
@@ -190,8 +190,8 @@
return OperationResult(1, error.toString());
}
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
await view.uiIsolate.flutterFastReassemble(classId);
}
}
@@ -227,7 +227,7 @@
return 2;
}
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
device.initLogReader();
}
try {
@@ -257,13 +257,13 @@
}
await refreshViews();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
// VM must have accepted the kernel binary, there will be no reload
// report, so we let incremental compiler know that source code was accepted.
if (device.generator != null) {
device.generator.accept();
}
- for (FlutterView view in device.views) {
+ for (final FlutterView view in device.views) {
globals.printTrace('Connected to $view.');
}
}
@@ -330,7 +330,7 @@
firstBuildTime = DateTime.now();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
final int result = await device.runHot(
hotRunner: this,
route: route,
@@ -349,7 +349,7 @@
Future<List<Uri>> _initDevFS() async {
final String fsName = globals.fs.path.basename(projectRootPath);
return <Uri>[
- for (FlutterDevice device in flutterDevices)
+ for (final FlutterDevice device in flutterDevices)
await device.setupDevFS(
fsName,
globals.fs.directory(projectRootPath),
@@ -378,7 +378,7 @@
asyncScanning: hotRunnerConfig.asyncScanning,
);
final UpdateFSReport results = UpdateFSReport(success: true);
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
results.incorporateResults(await device.updateDevFS(
mainPath: mainPath,
target: target,
@@ -397,14 +397,14 @@
}
void _resetDirtyAssets() {
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
device.devFS.assetPathsToEvict.clear();
}
}
Future<void> _cleanupDevFS() async {
final List<Future<void>> futures = <Future<void>>[];
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
if (device.devFS != null) {
// Cleanup the devFS, but don't wait indefinitely.
// We ignore any errors, because it's not clear what we would do anyway.
@@ -426,7 +426,7 @@
Uri assetsDirectoryUri,
) {
return Future.wait(<Future<void>>[
- for (FlutterView view in device.views)
+ for (final FlutterView view in device.views)
view.runFromSource(entryUri, packagesUri, assetsDirectoryUri),
]);
}
@@ -434,7 +434,7 @@
Future<void> _launchFromDevFS(String mainScript) async {
final String entryUri = globals.fs.path.relative(mainScript, from: projectRootPath);
final List<Future<void>> futures = <Future<void>>[];
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
final Uri deviceEntryUri = device.devFS.baseUri.resolveUri(
globals.fs.path.toUri(entryUri));
final Uri devicePackagesUri = device.devFS.baseUri.resolve('.packages');
@@ -448,8 +448,8 @@
await Future.wait(futures);
if (benchmarkMode) {
futures.clear();
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
futures.add(view.flushUIThreadTasks());
}
}
@@ -471,7 +471,7 @@
// compiler for full application recompilation on restart.
final UpdateFSReport updatedDevFS = await _updateDevFS(fullRestart: true);
if (!updatedDevFS.success) {
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
if (device.generator != null) {
await device.generator.reject();
}
@@ -479,7 +479,7 @@
return OperationResult(1, 'DevFS synchronization failed');
}
_resetDirtyAssets();
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
// VM must have accepted the kernel binary, there will be no reload
// report, so we let incremental compiler know that source code was accepted.
if (device.generator != null) {
@@ -488,8 +488,8 @@
}
// Check if the isolate is paused and resume it.
final List<Future<void>> futures = <Future<void>>[];
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
if (view.uiIsolate == null) {
continue;
}
@@ -522,12 +522,12 @@
// In benchmark mode, make sure all stream notifications have finished.
if (benchmarkMode) {
final List<Future<void>> isolateNotifications = <Future<void>>[];
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
isolateNotifications.add(
view.owner.vm.vmService.onIsolateEvent
.then((Stream<ServiceEvent> serviceEvents) async {
- await for (ServiceEvent serviceEvent in serviceEvents) {
+ await for (final ServiceEvent serviceEvent in serviceEvents) {
if (serviceEvent.owner.name.contains('_spawn')
&& serviceEvent.kind == ServiceEvent.kIsolateExit) {
return;
@@ -575,7 +575,7 @@
if (!(reloadReport['success'] as bool)) {
if (printErrors) {
globals.printError('Hot reload was rejected:');
- for (Map<String, dynamic> notice in reloadReport['details']['notices']) {
+ for (final Map<String, dynamic> notice in reloadReport['details']['notices']) {
globals.printError('${notice['message']}');
}
}
@@ -747,8 +747,8 @@
String reason,
void Function(String message) onSlow,
}) async {
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
if (view.uiIsolate == null) {
return OperationResult(2, 'Application isolate not found', fatal: true);
}
@@ -785,7 +785,7 @@
from: projectRootPath,
);
final List<Future<DeviceReloadReport>> allReportsFutures = <Future<DeviceReloadReport>>[];
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
if (_runningFromSnapshot) {
// Asset directory has to be set only once when we switch from
// running from snapshot to running from uploaded files.
@@ -809,7 +809,7 @@
));
}
final List<DeviceReloadReport> reports = await Future.wait(allReportsFutures);
- for (DeviceReloadReport report in reports) {
+ for (final DeviceReloadReport report in reports) {
final Map<String, dynamic> reloadReport = report.reports[0];
if (!validateReloadReport(reloadReport)) {
// Reload failed.
@@ -859,10 +859,10 @@
final Stopwatch reassembleTimer = Stopwatch()..start();
// Reload the isolate.
final List<Future<void>> allDevices = <Future<void>>[];
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
globals.printTrace('Sending reload events to ${device.device.name}');
final List<Future<ServiceObject>> futuresViews = <Future<ServiceObject>>[];
- for (FlutterView view in device.views) {
+ for (final FlutterView view in device.views) {
globals.printTrace('Sending reload event to "${view.uiIsolate.name}"');
futuresViews.add(view.uiIsolate.reload());
}
@@ -878,8 +878,8 @@
final List<FlutterView> reassembleViews = <FlutterView>[];
String serviceEventKind;
int pausedIsolatesFound = 0;
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
// Check if the isolate is paused, and if so, don't reassemble. Ignore the
// PostPauseEvent event - the client requesting the pause will resume the app.
final ServiceEvent pauseEvent = view.uiIsolate.pauseEvent;
@@ -910,7 +910,7 @@
globals.printTrace('Reassembling application');
bool failedReassemble = false;
final List<Future<void>> futures = <Future<void>>[
- for (FlutterView view in reassembleViews)
+ for (final FlutterView view in reassembleViews)
() async {
try {
await view.uiIsolate.flutterReassemble();
@@ -933,7 +933,7 @@
globals.printTrace('This is taking a long time; will now check for paused isolates.');
int postReloadPausedIsolatesFound = 0;
String serviceEventKind;
- for (FlutterView view in reassembleViews) {
+ for (final FlutterView view in reassembleViews) {
await view.uiIsolate.reload();
final ServiceEvent pauseEvent = view.uiIsolate.pauseEvent;
if (pauseEvent != null && pauseEvent.isPauseEvent) {
@@ -1030,8 +1030,8 @@
}
bool _isPaused() {
- for (FlutterDevice device in flutterDevices) {
- for (FlutterView view in device.views) {
+ for (final FlutterDevice device in flutterDevices) {
+ for (final FlutterView view in device.views) {
if (view.uiIsolate != null) {
final ServiceEvent pauseEvent = view.uiIsolate.pauseEvent;
if (pauseEvent != null && pauseEvent.isPauseEvent) {
@@ -1055,7 +1055,7 @@
TerminalColor.red,
);
globals.printStatus(message);
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
final String dname = device.device.name;
globals.printStatus('An Observatory debugger and profiler on $dname is '
'available at: ${device.vmService.httpAddress}');
@@ -1073,7 +1073,7 @@
Future<void> _evictDirtyAssets() {
final List<Future<Map<String, dynamic>>> futures = <Future<Map<String, dynamic>>>[];
- for (FlutterDevice device in flutterDevices) {
+ for (final FlutterDevice device in flutterDevices) {
if (device.devFS.assetPathsToEvict.isEmpty) {
continue;
}
@@ -1081,7 +1081,7 @@
globals.printError('Application isolate not found for $device');
continue;
}
- for (String assetPath in device.devFS.assetPathsToEvict) {
+ for (final String assetPath in device.devFS.assetPathsToEvict) {
futures.add(device.views.first.uiIsolate.flutterEvictAsset(assetPath));
}
device.devFS.assetPathsToEvict.clear();
@@ -1109,7 +1109,7 @@
@override
Future<void> cleanupAtFinish() async {
- for (FlutterDevice flutterDevice in flutterDevices) {
+ for (final FlutterDevice flutterDevice in flutterDevices) {
await flutterDevice.device.dispose();
}
await _cleanupDevFS();
@@ -1161,7 +1161,7 @@
final Stopwatch stopwatch = Stopwatch()..start();
final List<Uri> urisToScan = <Uri>[
// Don't watch pub cache directories to speed things up a little.
- for (Uri uri in urisToMonitor)
+ for (final Uri uri in urisToMonitor)
if (_isNotInPubCache(uri)) uri,
// We need to check the .packages file too since it is not used in compilation.
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index a04e402..0d81d6f 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -445,7 +445,7 @@
: null;
if (argParser.options.containsKey(FlutterOptions.kEnableExperiment) &&
argResults[FlutterOptions.kEnableExperiment] != null) {
- for (String expFlag in stringsArg(FlutterOptions.kEnableExperiment)) {
+ for (final String expFlag in stringsArg(FlutterOptions.kEnableExperiment)) {
final String flag = '--enable-experiment=' + expFlag;
if (extraFrontEndOptions != null) {
extraFrontEndOptions += ',' + flag;
@@ -743,7 +743,7 @@
final Set<DevelopmentArtifact> artifacts = <DevelopmentArtifact>{
DevelopmentArtifact.universal,
};
- for (Device device in devices) {
+ for (final Device device in devices) {
final TargetPlatform targetPlatform = await device.targetPlatform;
final DevelopmentArtifact developmentArtifact = _artifactFromTargetPlatform(targetPlatform);
if (developmentArtifact != null) {
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
index ca6d672..7731bd0 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -206,7 +206,7 @@
}
Command<void> command = commands[error.commands.first];
- for (String commandName in error.commands.skip(1)) {
+ for (final String commandName in error.commands.skip(1)) {
command = command.subcommands[commandName];
}
@@ -386,7 +386,7 @@
tmpBasename = tmpBasename.substring(tmpBasename.indexOf('_') + 1);
// Strip suffix for various archs.
final List<String> suffixes = <String>['_arm', '_arm64', '_x86', '_x64'];
- for (String suffix in suffixes) {
+ for (final String suffix in suffixes) {
tmpBasename = tmpBasename.replaceFirst(RegExp('$suffix\$'), '');
}
return 'host_' + tmpBasename;
diff --git a/packages/flutter_tools/lib/src/template.dart b/packages/flutter_tools/lib/src/template.dart
index f47f450..e37fddd 100644
--- a/packages/flutter_tools/lib/src/template.dart
+++ b/packages/flutter_tools/lib/src/template.dart
@@ -33,7 +33,7 @@
final List<FileSystemEntity> templateFiles = templateSource.listSync(recursive: true);
- for (FileSystemEntity entity in templateFiles) {
+ for (final FileSystemEntity entity in templateFiles) {
if (entity is! File) {
// We are only interesting in template *file* URIs.
continue;
diff --git a/packages/flutter_tools/lib/src/test/coverage_collector.dart b/packages/flutter_tools/lib/src/test/coverage_collector.dart
index b9dad72..2d8e6a8 100644
--- a/packages/flutter_tools/lib/src/test/coverage_collector.dart
+++ b/packages/flutter_tools/lib/src/test/coverage_collector.dart
@@ -188,7 +188,7 @@
Future<Map<String, dynamic>> _getAllCoverage(VMService service, bool Function(String) libraryPredicate) async {
await service.getVM();
final List<Map<String, dynamic>> coverage = <Map<String, dynamic>>[];
- for (Isolate isolateRef in service.vm.isolates) {
+ for (final Isolate isolateRef in service.vm.isolates) {
await isolateRef.load();
final Map<String, dynamic> scriptList = await isolateRef.invokeRpcRaw('getScripts', params: <String, dynamic>{'isolateId': isolateRef.id});
final List<Future<void>> futures = <Future<void>>[];
@@ -204,7 +204,7 @@
if (scriptList['scripts'] == null) {
continue;
}
- for (Map<String, dynamic> script in scriptList['scripts']) {
+ for (final Map<String, dynamic> script in scriptList['scripts']) {
if (!libraryPredicate(script['uri'] as String)) {
continue;
}
@@ -243,9 +243,9 @@
List<Map<String, dynamic>> coverage,
) {
final Map<String, Map<int, int>> hitMaps = <String, Map<int, int>>{};
- for (String scriptId in scripts.keys) {
+ for (final String scriptId in scripts.keys) {
final Map<String, dynamic> sourceReport = sourceReports[scriptId];
- for (Map<String, dynamic> range in sourceReport['ranges']) {
+ for (final Map<String, dynamic> range in sourceReport['ranges']) {
final Map<String, dynamic> coverage = castStringKeyedMap(range['coverage']);
// Coverage reports may sometimes be null for a Script.
if (coverage == null) {
@@ -264,14 +264,14 @@
continue;
}
if (hits != null) {
- for (int hit in hits) {
+ for (final int hit in hits) {
final int line = _lineAndColumn(hit, tokenPositions)[0];
final int current = hitMap[line] ?? 0;
hitMap[line] = current + 1;
}
}
if (misses != null) {
- for (int miss in misses) {
+ for (final int miss in misses) {
final int line = _lineAndColumn(miss, tokenPositions)[0];
hitMap[line] ??= 0;
}
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 8b73b57..c47af1e 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -678,7 +678,7 @@
} finally {
globals.printTrace('test $ourTestCount: cleaning up...');
// Finalizers are treated like a stack; run them in reverse order.
- for (Finalizer finalizer in finalizers.reversed) {
+ for (final Finalizer finalizer in finalizers.reversed) {
try {
await finalizer();
} catch (error, stack) {
@@ -850,7 +850,7 @@
void reportObservatoryUri(Uri uri),
}) {
const String observatoryString = 'Observatory listening on ';
- for (Stream<List<int>> stream in <Stream<List<int>>>[
+ for (final Stream<List<int>> stream in <Stream<List<int>>>[
process.stderr,
process.stdout,
]) {
diff --git a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart
index 7aa705b..c638f67 100644
--- a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart
@@ -440,7 +440,7 @@
/// the longest matching prefix wins.
void add(String path, shelf.Handler handler) {
_Node node = _paths;
- for (String component in p.url.split(path)) {
+ for (final String component in p.url.split(path)) {
node = node.children.putIfAbsent(component, () => _Node());
}
node.handler = handler;
@@ -489,7 +489,7 @@
// Start this canceled because we don't want it to start ticking until we
// get some response from the iframe.
_timer = RestartableTimer(const Duration(seconds: 3), () {
- for (RunnerSuiteController controller in _controllers) {
+ for (final RunnerSuiteController controller in _controllers) {
controller.setDebugging(true);
}
})
@@ -503,7 +503,7 @@
if (!_closed) {
_timer.reset();
}
- for (RunnerSuiteController controller in _controllers) {
+ for (final RunnerSuiteController controller in _controllers) {
controller.setDebugging(false);
}
@@ -933,7 +933,7 @@
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.map<Object>(jsonDecode);
- await for (Object command in commands) {
+ await for (final Object command in commands) {
if (command is Map<String, dynamic>) {
File imageFile = File(command['imageFile']);
Uri goldenKey = Uri.parse(command['key']);
diff --git a/packages/flutter_tools/lib/src/test/runner.dart b/packages/flutter_tools/lib/src/test/runner.dart
index 593603d..490cf50 100644
--- a/packages/flutter_tools/lib/src/test/runner.dart
+++ b/packages/flutter_tools/lib/src/test/runner.dart
@@ -61,9 +61,9 @@
else
...<String>['-r', 'compact'],
'--concurrency=$concurrency',
- for (String name in names)
+ for (final String name in names)
...<String>['--name', name],
- for (String plainName in plainNames)
+ for (final String plainName in plainNames)
...<String>['--plain-name', plainName],
'--test-randomize-ordering-seed=$randomSeed',
];
diff --git a/packages/flutter_tools/lib/src/tracing.dart b/packages/flutter_tools/lib/src/tracing.dart
index 623a10d..020d068 100644
--- a/packages/flutter_tools/lib/src/tracing.dart
+++ b/packages/flutter_tools/lib/src/tracing.dart
@@ -51,7 +51,7 @@
}
});
bool done = false;
- for (FlutterView view in vmService.vm.views) {
+ for (final FlutterView view in vmService.vm.views) {
if (await view.uiIsolate.flutterAlreadyPaintedFirstUsefulFrame()) {
done = true;
break;
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index 9d0450e..99adc78 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -856,7 +856,7 @@
void _removeDeadIsolates(List<Isolate> newIsolates) {
// Build a set of new isolates.
final Set<String> newIsolateSet = <String>{};
- for (Isolate iso in newIsolates) {
+ for (final Isolate iso in newIsolates) {
newIsolateSet.add(iso.id);
}
diff --git a/packages/flutter_tools/lib/src/vscode/vscode.dart b/packages/flutter_tools/lib/src/vscode/vscode.dart
index 6410493..b110046 100644
--- a/packages/flutter_tools/lib/src/vscode/vscode.dart
+++ b/packages/flutter_tools/lib/src/vscode/vscode.dart
@@ -204,7 +204,7 @@
final List<VsCode> results = <VsCode>[];
- for (_VsCodeInstallLocation searchLocation in searchLocations) {
+ for (final _VsCodeInstallLocation searchLocation in searchLocations) {
if (globals.fs.isDirectorySync(searchLocation.installPath)) {
final String extensionDirectory =
globals.fs.path.join(homeDirPath, searchLocation.extensionsFolder, 'extensions');
diff --git a/packages/flutter_tools/lib/src/web/compile.dart b/packages/flutter_tools/lib/src/web/compile.dart
index 8f024d2..c062031 100644
--- a/packages/flutter_tools/lib/src/web/compile.dart
+++ b/packages/flutter_tools/lib/src/web/compile.dart
@@ -53,7 +53,7 @@
},
));
if (!result.success) {
- for (ExceptionMeasurement measurement in result.exceptions.values) {
+ for (final ExceptionMeasurement measurement in result.exceptions.values) {
globals.printError('Target ${measurement.target} failed: ${measurement.exception}',
stackTrace: measurement.fatal
? measurement.stackTrace
diff --git a/packages/flutter_tools/lib/src/web/devfs_web.dart b/packages/flutter_tools/lib/src/web/devfs_web.dart
index c28815b..e24ef5e 100644
--- a/packages/flutter_tools/lib/src/web/devfs_web.dart
+++ b/packages/flutter_tools/lib/src/web/devfs_web.dart
@@ -177,7 +177,7 @@
final Uint8List codeBytes = codeFile.readAsBytesSync();
final Uint8List sourcemapBytes = sourcemapFile.readAsBytesSync();
final Map<String, dynamic> manifest = castStringKeyedMap(json.decode(manifestFile.readAsStringSync()));
- for (String filePath in manifest.keys) {
+ for (final String filePath in manifest.keys) {
if (filePath == null) {
globals.printTrace('Invalid manfiest file: $filePath');
continue;
diff --git a/packages/flutter_tools/lib/src/windows/windows_device.dart b/packages/flutter_tools/lib/src/windows/windows_device.dart
index 1161d6d..f7f0b65 100644
--- a/packages/flutter_tools/lib/src/windows/windows_device.dart
+++ b/packages/flutter_tools/lib/src/windows/windows_device.dart
@@ -93,7 +93,7 @@
if (result.exitCode != 0) {
return null;
}
- for (String rawProcess in result.stdout.split('\n')) {
+ for (final String rawProcess in result.stdout.split('\n')) {
final String process = rawProcess.trim();
if (!process.contains(processName)) {
continue;
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart
index 52922ca..7565fa3 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart
@@ -106,7 +106,7 @@
globals.fs.path.join('bin', 'cache', 'dart-sdk', 'bin', 'dart'),
globals.fs.path.join('bin', 'cache', 'dart-sdk '),
];
- for (String dependency in dependencies) {
+ for (final String dependency in dependencies) {
globals.fs.file(dependency).createSync(recursive: true);
}
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
index dc77557..a9db5b9 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
@@ -31,7 +31,7 @@
globals.fs.path.join('usr', 'local', 'bin', 'adb'),
globals.fs.path.join('Android', 'platform-tools', 'adb.exe'),
];
- for (String path in paths) {
+ for (final String path in paths) {
globals.fs.file(path).createSync(recursive: true);
}
}, overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
index 5b3e077..a6ec89b 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
@@ -499,11 +499,11 @@
expect(await FlutterValidatorDoctor().diagnose(verbose: false), isTrue);
final List<String> statusLines = testLogger.statusText.split('\n');
- for (String msg in userMessages.flutterBinariesDoNotRun.split('\n')) {
+ for (final String msg in userMessages.flutterBinariesDoNotRun.split('\n')) {
expect(statusLines, contains(contains(msg)));
}
if (globals.platform.isLinux) {
- for (String msg in userMessages.flutterBinariesLinuxRepairCommands.split('\n')) {
+ for (final String msg in userMessages.flutterBinariesLinuxRepairCommands.split('\n')) {
expect(statusLines, contains(contains(msg)));
}
}
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/ide_config_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/ide_config_test.dart
index 3e22868..adda297 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/ide_config_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/ide_config_test.dart
@@ -29,7 +29,7 @@
return relativePath;
}).toList();
final Map<String, String> contents = <String, String>{};
- for (String path in paths) {
+ for (final String path in paths) {
final String absPath = globals.fs.path.join(tempPath, path);
if (globals.fs.isDirectorySync(absPath)) {
contents[path] = 'dir';
@@ -56,12 +56,12 @@
}
void _populateDir(Map<String, String> manifest) {
- for (String key in manifest.keys) {
+ for (final String key in manifest.keys) {
if (manifest[key] == 'dir') {
tempDir.childDirectory(key)..createSync(recursive: true);
}
}
- for (String key in manifest.keys) {
+ for (final String key in manifest.keys) {
if (manifest[key] != 'dir') {
tempDir.childFile(key)
..createSync(recursive: true)
@@ -90,7 +90,7 @@
...args,
]);
- for (String path in expectedContents.keys) {
+ for (final String path in expectedContents.keys) {
final String absPath = globals.fs.path.join(tempDir.absolute.path, path);
expect(_fileOrDirectoryExists(globals.fs.path.join(dir.path, path)), true,
reason: "$path doesn't exist");
@@ -99,7 +99,7 @@
reason: "$path contents don't match");
}
}
- for (String path in unexpectedPaths) {
+ for (final String path in unexpectedPaths) {
expect(_fileOrDirectoryExists(globals.fs.path.join(dir.path, path)), false, reason: '$path exists');
}
}
diff --git a/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart b/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart
index 9ff81a8..5d988d0 100644
--- a/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart
+++ b/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart
@@ -258,7 +258,7 @@
if (patterns == null) {
expect(text, isEmpty);
} else {
- for (String pattern in patterns) {
+ for (final String pattern in patterns) {
expect(text, contains(pattern));
}
}
diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart
index b1d284e..049bec8 100644
--- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart
+++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart
@@ -645,7 +645,7 @@
expect(actualContents.contains('flutter_test.dart'), true);
- for (FileSystemEntity file in projectDir.listSync(recursive: true)) {
+ for (final FileSystemEntity file in projectDir.listSync(recursive: true)) {
if (file is File && file.path.endsWith('.dart')) {
final String original = file.readAsStringSync();
@@ -737,7 +737,7 @@
expectExists('lib/main.dart');
expectExists('test/widget_test.dart');
- for (FileSystemEntity file in projectDir.listSync(recursive: true)) {
+ for (final FileSystemEntity file in projectDir.listSync(recursive: true)) {
if (file is File && file.path.endsWith('.dart')) {
final String original = file.readAsStringSync();
@@ -1227,10 +1227,10 @@
}
final List<String> failures = <String>[
- for (String path in expectedPaths)
+ for (final String path in expectedPaths)
if (!pathExists(path))
'Path "$path" does not exist.',
- for (String path in unexpectedPaths)
+ for (final String path in unexpectedPaths)
if (pathExists(path))
'Path "$path" exists when it shouldn\'t.',
];
diff --git a/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart b/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
index 657b580..b48c9d5 100644
--- a/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
+++ b/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
@@ -146,7 +146,7 @@
};
void expectDependenciesResolved(String projectPath) {
- for (String output in pubOutput) {
+ for (final String output in pubOutput) {
expectExists(projectPath, output);
}
}
@@ -193,7 +193,7 @@
modulePluginRegistrants,
pluginWitnesses,
].expand<String>((List<String> list) => list);
- for (String path in allFiles) {
+ for (final String path in allFiles) {
final File file = globals.fs.file(globals.fs.path.join(projectPath, path));
if (file.existsSync()) {
file.deleteSync();
diff --git a/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart b/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
index 736531b..b1cfd66 100644
--- a/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
@@ -201,7 +201,7 @@
});
});
- for (String os in <String>['linux', 'macos']) {
+ for (final String os in <String>['linux', 'macos']) {
testUsingContext('detection on $os (no ndk available)', () {
sdkDir = MockAndroidSdk.createSdkDirectory(withAndroidN: true);
globals.config.setValue('android-sdk', sdkDir.path);
diff --git a/packages/flutter_tools/test/general.shard/android/gradle_test.dart b/packages/flutter_tools/test/general.shard/android/gradle_test.dart
index 17cb651..83f69c7 100644
--- a/packages/flutter_tools/test/general.shard/android/gradle_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/gradle_test.dart
@@ -441,10 +441,10 @@
'See https://goo.gl/CP92wY for more information on the problem and how to fix it.',
'This warning prints for all Android build failures. The real root cause of the error may be unrelated.',
];
- for (String m in nonMatchingLines) {
+ for (final String m in nonMatchingLines) {
expect(androidXPluginWarningRegex.hasMatch(m), isFalse);
}
- for (String m in matchingLines) {
+ for (final String m in matchingLines) {
expect(androidXPluginWarningRegex.hasMatch(m), isTrue);
}
});
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
index 222c96f..6ce0823 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
@@ -70,8 +70,8 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
- for (String packageName in packages) {
- for (String packageFont in packageFonts) {
+ for (final String packageName in packages) {
+ for (final String packageFont in packageFonts) {
final String entryKey = 'packages/$packageName/$packageFont';
expect(bundle.entries.containsKey(entryKey), true);
expect(
@@ -80,7 +80,7 @@
);
}
- for (String localFont in localFonts) {
+ for (final String localFont in localFonts) {
expect(bundle.entries.containsKey(localFont), true);
expect(
utf8.decode(await bundle.entries[localFont].contentsAsBytes()),
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
index 25e2089..e75dde6 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
@@ -38,7 +38,7 @@
assets:
''');
- for (String asset in assets) {
+ for (final String asset in assets) {
buffer.write('''
- $asset
''');
@@ -75,8 +75,8 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
- for (String packageName in packages) {
- for (String asset in assets) {
+ for (final String packageName in packages) {
+ for (final String asset in assets) {
final String entryKey = Uri.encodeFull('packages/$packageName/$asset');
expect(bundle.entries.containsKey(entryKey), true, reason: 'Cannot find key on bundle: $entryKey');
expect(
@@ -93,7 +93,7 @@
}
void writeAssets(String path, List<String> assets) {
- for (String asset in assets) {
+ for (final String asset in assets) {
final String fullPath = fixPath(globals.fs.path.join(path, asset));
globals.fs.file(fullPath)
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
index dcd7627..5fa9fda 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
@@ -65,7 +65,7 @@
'a/b/c/var2/foo',
'a/b/c/var3/foo',
];
- for (String asset in assets) {
+ for (final String asset in assets) {
globals.fs.file(fixPath(asset))
..createSync(recursive: true)
..writeAsStringSync(asset);
@@ -75,7 +75,7 @@
await bundle.build(manifestPath: 'pubspec.yaml');
// The main asset file, /a/b/c/foo, and its variants exist.
- for (String asset in assets) {
+ for (final String asset in assets) {
expect(bundle.entries.containsKey(asset), true);
expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset);
}
@@ -87,7 +87,7 @@
// Now the main asset file, /a/b/c/foo, does not exist. This is OK because
// the /a/b/c/*/foo variants do exist.
expect(bundle.entries.containsKey('a/b/c/foo'), false);
- for (String asset in assets.skip(1)) {
+ for (final String asset in assets.skip(1)) {
expect(bundle.entries.containsKey(asset), true);
expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset);
}
diff --git a/packages/flutter_tools/test/general.shard/base/build_test.dart b/packages/flutter_tools/test/general.shard/base/build_test.dart
index 62c4c18..450e818 100644
--- a/packages/flutter_tools/test/general.shard/base/build_test.dart
+++ b/packages/flutter_tools/test/general.shard/base/build_test.dart
@@ -248,7 +248,7 @@
when(mockXcode.sdkLocation(any)).thenAnswer((_) => Future<String>.value(kSDKPath));
bufferLogger = BufferLogger();
- for (BuildMode mode in BuildMode.values) {
+ for (final BuildMode mode in BuildMode.values) {
when(mockArtifacts.getArtifactPath(Artifact.snapshotDart,
platform: anyNamed('platform'), mode: mode)).thenReturn(kSnapshotDart);
}
diff --git a/packages/flutter_tools/test/general.shard/base/logger_test.dart b/packages/flutter_tools/test/general.shard/base/logger_test.dart
index b30772b..189464c 100644
--- a/packages/flutter_tools/test/general.shard/base/logger_test.dart
+++ b/packages/flutter_tools/test/general.shard/base/logger_test.dart
@@ -103,7 +103,7 @@
} while (doThis());
}
- for (String testOs in testPlatforms) {
+ for (final String testOs in testPlatforms) {
testUsingContext('AnsiSpinner works for $testOs (1)', () async {
bool done = false;
mockStopwatch = FakeStopwatch();
@@ -255,7 +255,7 @@
expect(outputStdout().join('\n'), contains('This is taking an unexpectedly long time.'));
// Test that the number of '\b' is correct.
- for (String line in outputStdout()) {
+ for (final String line in outputStdout()) {
int currLength = 0;
for (int i = 0; i < line.length; i += 1) {
currLength += line[i] == '\b' ? -1 : 1;
diff --git a/packages/flutter_tools/test/general.shard/base/terminal_test.dart b/packages/flutter_tools/test/general.shard/base/terminal_test.dart
index f6bc675..ff62a6f 100644
--- a/packages/flutter_tools/test/general.shard/base/terminal_test.dart
+++ b/packages/flutter_tools/test/general.shard/base/terminal_test.dart
@@ -40,7 +40,7 @@
});
testUsingContext('adding colors works', () {
- for (TerminalColor color in TerminalColor.values) {
+ for (final TerminalColor color in TerminalColor.values) {
expect(
terminal.color('output', color),
equals('${AnsiTerminal.colorCode(color)}output${AnsiTerminal.resetColor}'),
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart
index b83b51b..9d83b2e 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart
@@ -96,7 +96,7 @@
globals.fs.path.join('packages', 'flutter_tools', 'lib', 'src', 'build_system', 'targets', 'dart.dart'),
globals.fs.path.join('packages', 'flutter_tools', 'lib', 'src', 'build_system', 'targets', 'ios.dart'),
];
- for (String path in paths) {
+ for (final String path in paths) {
globals.fs.file(path).createSync(recursive: true);
}
}, overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
index cd09381..56f7b3d 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
@@ -82,7 +82,7 @@
});
test('Copies files to correct cache directory', () => testbed.run(() async {
- for (File input in inputs) {
+ for (final File input in inputs) {
input.createSync(recursive: true);
}
// Create output directory so we can test that it is deleted.
@@ -100,7 +100,7 @@
expect(target.existsSync(), false);
target.createSync(recursive: true);
- for (FileSystemEntity entity in source.listSync(recursive: true)) {
+ for (final FileSystemEntity entity in source.listSync(recursive: true)) {
if (entity is File) {
final String relative = globals.fs.path.relative(entity.path, from: source.path);
final String destination = globals.fs.path.join(target.path, relative);
@@ -115,7 +115,7 @@
await const DebugUnpackMacOS().build(environment);
expect(globals.fs.directory('$_kOutputPrefix').existsSync(), true);
- for (File file in inputs) {
+ for (final File file in inputs) {
expect(globals.fs.file(file.path.replaceFirst(_kInputPrefix, _kOutputPrefix)).existsSync(), true);
}
}));
diff --git a/packages/flutter_tools/test/general.shard/dart/sdk_validation_test.dart b/packages/flutter_tools/test/general.shard/dart/sdk_validation_test.dart
index 9d864c1..e91b4cc 100644
--- a/packages/flutter_tools/test/general.shard/dart/sdk_validation_test.dart
+++ b/packages/flutter_tools/test/general.shard/dart/sdk_validation_test.dart
@@ -64,7 +64,7 @@
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
server.onErrors.listen((FileAnalysisErrors result) {
- for (AnalysisError error in result.errors) {
+ for (final AnalysisError error in result.errors) {
print(error.toString().trim());
}
errorCount += result.errors.length;
diff --git a/packages/flutter_tools/test/general.shard/forbidden_imports_test.dart b/packages/flutter_tools/test/general.shard/forbidden_imports_test.dart
index dce6b55..eb771ab 100644
--- a/packages/flutter_tools/test/general.shard/forbidden_imports_test.dart
+++ b/packages/flutter_tools/test/general.shard/forbidden_imports_test.dart
@@ -22,8 +22,8 @@
.where(_isDartFile)
.where(_isNotSkipped)
.map(_asFile);
- for (File file in files) {
- for (String line in file.readAsLinesSync()) {
+ for (final File file in files) {
+ for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:'))) {
continue;
}
@@ -47,8 +47,8 @@
.where(_isDartFile)
.where(_isNotSkipped)
.map(_asFile);
- for (File file in files) {
- for (String line in file.readAsLinesSync()) {
+ for (final File file in files) {
+ for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*globals.dart'))
&& !line.contains(r'as globals')) {
final String relativePath = globals.fs.path.relative(file.path, from:flutterTools);
@@ -65,14 +65,14 @@
];
bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => path != entity.path);
- for (String dirName in <String>['lib', 'bin']) {
+ for (final String dirName in <String>['lib', 'bin']) {
final Iterable<File> files = globals.fs.directory(globals.fs.path.join(flutterTools, dirName))
.listSync(recursive: true)
.where(_isDartFile)
.where(_isNotWhitelisted)
.map(_asFile);
- for (File file in files) {
- for (String line in file.readAsLinesSync()) {
+ for (final File file in files) {
+ for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*dart:io')) &&
!line.contains('ignore: dart_io_import')) {
final String relativePath = globals.fs.path.relative(file.path, from:flutterTools);
@@ -92,14 +92,14 @@
];
bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => path != entity.path);
- for (String dirName in <String>['lib']) {
+ for (final String dirName in <String>['lib']) {
final Iterable<File> files = globals.fs.directory(globals.fs.path.join(flutterTools, dirName))
.listSync(recursive: true)
.where(_isDartFile)
.where(_isNotWhitelisted)
.map(_asFile);
- for (File file in files) {
- for (String line in file.readAsLinesSync()) {
+ for (final File file in files) {
+ for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:test_api')) &&
!line.contains('ignore: test_api_import')) {
final String relativePath = globals.fs.path.relative(file.path, from:flutterTools);
@@ -112,14 +112,14 @@
test('no unauthorized imports of package:path', () {
final String whitelistedPath = globals.fs.path.join(flutterTools, 'lib', 'src', 'build_runner', 'web_compilation_delegate.dart');
- for (String dirName in <String>['lib', 'bin', 'test']) {
+ for (final String dirName in <String>['lib', 'bin', 'test']) {
final Iterable<File> files = globals.fs.directory(globals.fs.path.join(flutterTools, dirName))
.listSync(recursive: true)
.where(_isDartFile)
.where((FileSystemEntity entity) => entity.path != whitelistedPath)
.map(_asFile);
- for (File file in files) {
- for (String line in file.readAsLinesSync()) {
+ for (final File file in files) {
+ for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:path/path.dart')) &&
!line.contains('ignore: package_path_import')) {
final String relativePath = globals.fs.path.relative(file.path, from:flutterTools);
@@ -137,14 +137,14 @@
];
bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => path != entity.path);
- for (String dirName in <String>['lib']) {
+ for (final String dirName in <String>['lib']) {
final Iterable<File> files = globals.fs.directory(globals.fs.path.join(flutterTools, dirName))
.listSync(recursive: true)
.where(_isDartFile)
.where(_isNotWhitelisted)
.map(_asFile);
- for (File file in files) {
- for (String line in file.readAsLinesSync()) {
+ for (final File file in files) {
+ for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*dart:convert')) &&
!line.contains('ignore: dart_convert_import')) {
final String relativePath = globals.fs.path.relative(file.path, from:flutterTools);
@@ -163,14 +163,14 @@
];
bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => !entity.path.contains(path));
- for (String dirName in <String>['lib']) {
+ for (final String dirName in <String>['lib']) {
final Iterable<File> files = globals.fs.directory(globals.fs.path.join(flutterTools, dirName))
.listSync(recursive: true)
.where(_isDartFile)
.where(_isNotWhitelisted)
.map(_asFile);
- for (File file in files) {
- for (String line in file.readAsLinesSync()) {
+ for (final File file in files) {
+ for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:build_runner_core/build_runner_core.dart')) ||
line.startsWith(RegExp(r'import.*package:build_runner/build_runner.dart')) ||
line.startsWith(RegExp(r'import.*package:build_config/build_config.dart')) ||
diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
index d5b4e58..3bc889f 100644
--- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
@@ -337,7 +337,7 @@
Future<Uri> findUri(List<MockFlutterView> views, String expectedIsolateName) async {
when(vm.views).thenReturn(views);
- for (MockFlutterView view in views) {
+ for (final MockFlutterView view in views) {
when(view.owner).thenReturn(vm);
}
final MockFuchsiaDevice fuchsiaDevice =
diff --git a/packages/flutter_tools/test/general.shard/ios/devices_test.dart b/packages/flutter_tools/test/general.shard/ios/devices_test.dart
index 4820ae2..fbf7ff0 100644
--- a/packages/flutter_tools/test/general.shard/ios/devices_test.dart
+++ b/packages/flutter_tools/test/general.shard/ios/devices_test.dart
@@ -80,7 +80,7 @@
Platform: () => macPlatform,
});
- for (Platform platform in unsupportedPlatforms) {
+ for (final Platform platform in unsupportedPlatforms) {
testUsingContext('throws UnsupportedError exception if instantiated on ${platform.operatingSystem}', () {
expect(
() { IOSDevice('device-123'); },
@@ -781,7 +781,7 @@
});
final List<Platform> unsupportedPlatforms = <Platform>[linuxPlatform, windowsPlatform];
- for (Platform platform in unsupportedPlatforms) {
+ for (final Platform platform in unsupportedPlatforms) {
testUsingContext('throws Unsupported Operation exception on ${platform.operatingSystem}', () async {
when(iMobileDevice.isInstalled).thenReturn(false);
when(iMobileDevice.getAvailableDeviceIDs())
diff --git a/packages/flutter_tools/test/general.shard/plugins_test.dart b/packages/flutter_tools/test/general.shard/plugins_test.dart
index 7d2d821..30b4401 100644
--- a/packages/flutter_tools/test/general.shard/plugins_test.dart
+++ b/packages/flutter_tools/test/general.shard/plugins_test.dart
@@ -208,7 +208,7 @@
pluginClass: UseNewEmbedding
dependencies:
''');
- for (String dependency in dependencies) {
+ for (final String dependency in dependencies) {
pluginDirectory
.childFile('pubspec.yaml')
.writeAsStringSync(' $dependency:\n', mode: FileMode.append);
diff --git a/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart b/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
index 3d251a5..d46e5629 100644
--- a/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
+++ b/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
@@ -14,7 +14,7 @@
final DateTime inFuture = DateTime.now().add(const Duration(days: 100));
void main() {
- for (bool asyncScanning in <bool>[true, false]) {
+ for (final bool asyncScanning in <bool>[true, false]) {
testWithoutContext('No last compile, asyncScanning: $asyncScanning', () async {
final ProjectFileInvalidator projectFileInvalidator = ProjectFileInvalidator(
fileSystem: MemoryFileSystem(),
diff --git a/packages/flutter_tools/test/general.shard/project_test.dart b/packages/flutter_tools/test/general.shard/project_test.dart
index d42a617..1fcdfe6 100644
--- a/packages/flutter_tools/test/general.shard/project_test.dart
+++ b/packages/flutter_tools/test/general.shard/project_test.dart
@@ -643,7 +643,7 @@
void transfer(FileSystemEntity entity, FileSystem target) {
if (entity is Directory) {
target.directory(entity.absolute.path).createSync(recursive: true);
- for (FileSystemEntity child in entity.listSync()) {
+ for (final FileSystemEntity child in entity.listSync()) {
transfer(child, target);
}
} else if (entity is File) {
diff --git a/packages/flutter_tools/test/general.shard/version_test.dart b/packages/flutter_tools/test/general.shard/version_test.dart
index bf68b53..41d77c0 100644
--- a/packages/flutter_tools/test/general.shard/version_test.dart
+++ b/packages/flutter_tools/test/general.shard/version_test.dart
@@ -30,7 +30,7 @@
mockCache = MockCache();
});
- for (String channel in FlutterVersion.officialChannels) {
+ for (final String channel in FlutterVersion.officialChannels) {
DateTime getChannelUpToDateVersion() {
return _testClock.ago(FlutterVersion.versionAgeConsideredUpToDate(channel) ~/ 2);
}
diff --git a/packages/flutter_tools/test/integration.shard/test_driver.dart b/packages/flutter_tools/test/integration.shard/test_driver.dart
index 8dc062f..7fa4c91 100644
--- a/packages/flutter_tools/test/integration.shard/test_driver.dart
+++ b/packages/flutter_tools/test/integration.shard/test_driver.dart
@@ -319,7 +319,7 @@
}
SourcePosition _lookupTokenPos(List<List<int>> table, int tokenPos) {
- for (List<int> row in table) {
+ for (final List<int> row in table) {
final int lineNumber = row[0];
int index = 1;
diff --git a/packages/flutter_tools/test/src/fake_process_manager.dart b/packages/flutter_tools/test/src/fake_process_manager.dart
index 0e822fd..1a1830a 100644
--- a/packages/flutter_tools/test/src/fake_process_manager.dart
+++ b/packages/flutter_tools/test/src/fake_process_manager.dart
@@ -105,7 +105,7 @@
if (environment == null) {
return false;
}
- for (String key in environment.keys) {
+ for (final String key in environment.keys) {
if (environment[key] != this.environment[key]) {
return false;
}
diff --git a/packages/flutter_tools/test/src/mocks.dart b/packages/flutter_tools/test/src/mocks.dart
index 95fdd64..5929c1c 100644
--- a/packages/flutter_tools/test/src/mocks.dart
+++ b/packages/flutter_tools/test/src/mocks.dart
@@ -399,7 +399,7 @@
@override
void writeAll(Iterable<dynamic> objects, [ String separator = '' ]) {
bool addSeparator = false;
- for (dynamic object in objects) {
+ for (final dynamic object in objects) {
if (addSeparator) {
write(separator);
}
diff --git a/packages/flutter_tools/test/src/testbed.dart b/packages/flutter_tools/test/src/testbed.dart
index 2022ebf..ab68e92 100644
--- a/packages/flutter_tools/test/src/testbed.dart
+++ b/packages/flutter_tools/test/src/testbed.dart
@@ -139,7 +139,7 @@
}
await test();
Cache.flutterRoot = originalFlutterRoot;
- for (MapEntry<Timer, StackTrace> entry in timers.entries) {
+ for (final MapEntry<Timer, StackTrace> entry in timers.entries) {
if (entry.key.isActive) {
throw StateError('A Timer was active at the end of a test: ${entry.value}');
}
diff --git a/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart b/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart
index 1392872..9985da3 100644
--- a/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart
+++ b/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart
@@ -36,13 +36,13 @@
final FuchsiaRemoteConnection connection =
await FuchsiaRemoteConnection.connect(address, interface, sshConfigPath);
print('On $address, the following Dart VM ports are running:');
- for (int port in await connection.getDeviceServicePorts()) {
+ for (final int port in await connection.getDeviceServicePorts()) {
print('\t$port');
}
print('');
print('The following Flutter views are running:');
- for (FlutterView view in await connection.getFlutterViews()) {
+ for (final FlutterView view in await connection.getFlutterViews()) {
print('\t${view.name ?? view.id}');
}
await connection.stop();
diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart b/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart
index 547dae9..847fad9 100644
--- a/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart
+++ b/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart
@@ -170,7 +170,7 @@
final Map<String, dynamic> jsonVmRef =
await invokeRpc('getVM', timeout: timeout);
final List<IsolateRef> result = <IsolateRef>[];
- for (Map<String, dynamic> jsonIsolate in jsonVmRef['isolates']) {
+ for (final Map<String, dynamic> jsonIsolate in jsonVmRef['isolates']) {
final String name = jsonIsolate['name'] as String;
if (pattern.matchAsPrefix(name) != null) {
_log.fine('Found Isolate matching "$pattern": "$name"');
@@ -213,7 +213,7 @@
final List<FlutterView> views = <FlutterView>[];
final Map<String, dynamic> rpcResponse =
await invokeRpc('_flutter.listViews', timeout: timeout);
- for (Map<String, dynamic> jsonView in rpcResponse['views']) {
+ for (final Map<String, dynamic> jsonView in rpcResponse['views']) {
final FlutterView flutterView = FlutterView._fromJson(jsonView);
if (flutterView != null) {
views.add(flutterView);
diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart
index 08f9906..18d9f74 100644
--- a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart
+++ b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart
@@ -221,7 +221,7 @@
/// those objects) will subsequently have its connection closed as well, so
/// behavior for them will be undefined.
Future<void> stop() async {
- for (PortForwarder pf in _forwardedVmServicePorts) {
+ for (final PortForwarder pf in _forwardedVmServicePorts) {
// Closes VM service first to ensure that the connection is closed cleanly
// on the target before shutting down the forwarding itself.
final DartVm vmService = _dartVmCache[pf.port];
@@ -229,7 +229,7 @@
await vmService?.stop();
await pf.stop();
}
- for (PortForwarder pf in _dartVmPortMap.values) {
+ for (final PortForwarder pf in _dartVmPortMap.values) {
final DartVm vmService = _dartVmCache[pf.port];
_dartVmCache[pf.port] = null;
await vmService?.stop();
@@ -305,7 +305,7 @@
// simultaneously via Future.wait.
final List<Future<List<IsolateRef>>> isolates =
<Future<List<IsolateRef>>>[];
- for (PortForwarder fp in _dartVmPortMap.values) {
+ for (final PortForwarder fp in _dartVmPortMap.values) {
final DartVm vmService =
await _getDartVm(fp.port, timeout: vmConnectionTimeout);
if (vmService == null) {
@@ -390,7 +390,7 @@
}
}
- for (PortForwarder pf in _dartVmPortMap.values) {
+ for (final PortForwarder pf in _dartVmPortMap.values) {
final DartVm service = await _getDartVm(pf.port);
if (service == null) {
await shutDownPortForwarder(pf);
@@ -448,7 +448,7 @@
Future<void> _pollVms() async {
await _checkPorts();
final List<int> servicePorts = await getDeviceServicePorts();
- for (int servicePort in servicePorts) {
+ for (final int servicePort in servicePorts) {
if (!_stalePorts.contains(servicePort) &&
!_dartVmPortMap.containsKey(servicePort)) {
_dartVmPortMap[servicePort] = await fuchsiaPortForwardingFunction(
@@ -499,7 +499,7 @@
_sshCommandRunner.sshConfigPath);
}));
- for (PortForwarder pf in forwardedVmServicePorts) {
+ for (final PortForwarder pf in forwardedVmServicePorts) {
// TODO(awdavies): Handle duplicates.
_dartVmPortMap[pf.remotePort] = pf;
}
@@ -521,13 +521,13 @@
final List<String> portPaths = await _sshCommandRunner
.run('/bin/find /hub -name vmservice-port');
final List<int> ports = <int>[];
- for (String path in portPaths) {
+ for (final String path in portPaths) {
if (path == '') {
continue;
}
final List<String> lsOutput =
await _sshCommandRunner.run('/bin/ls $path');
- for (String line in lsOutput) {
+ for (final String line in lsOutput) {
if (line == '') {
continue;
}