diff --git a/dev/benchmarks/complex_layout/test/measure_scroll_smoothness.dart b/dev/benchmarks/complex_layout/test/measure_scroll_smoothness.dart index 03aaa2f6c4..54f8afc248 100644 --- a/dev/benchmarks/complex_layout/test/measure_scroll_smoothness.dart +++ b/dev/benchmarks/complex_layout/test/measure_scroll_smoothness.dart @@ -68,7 +68,7 @@ class ResampleFlagVariant extends TestVariant { late TestScenario currentValue; bool get resample { - switch(currentValue) { + switch (currentValue) { case TestScenario.resampleOn90Hz: case TestScenario.resampleOn59Hz: return true; @@ -78,7 +78,7 @@ class ResampleFlagVariant extends TestVariant { } } double get frequency { - switch(currentValue) { + switch (currentValue) { case TestScenario.resampleOn90Hz: case TestScenario.resampleOff90Hz: return 90.0; @@ -92,7 +92,7 @@ class ResampleFlagVariant extends TestVariant { @override String describeValue(TestScenario value) { - switch(value) { + switch (value) { case TestScenario.resampleOn90Hz: return 'resample on with 90Hz input'; case TestScenario.resampleOn59Hz: diff --git a/dev/benchmarks/macrobenchmarks/test_driver/frame_policy_test.dart b/dev/benchmarks/macrobenchmarks/test_driver/frame_policy_test.dart index 9686e54243..3f9dc7f75d 100644 --- a/dev/benchmarks/macrobenchmarks/test_driver/frame_policy_test.dart +++ b/dev/benchmarks/macrobenchmarks/test_driver/frame_policy_test.dart @@ -13,7 +13,7 @@ Future main() => driver.integrationDriver( final Map fullyLiveResult = data?['fullyLive'] as Map; - if(benchmarkLiveResult['frame_count'] as int < 10 + if (benchmarkLiveResult['frame_count'] as int < 10 || fullyLiveResult['frame_count'] as int < 10) { print('Failure Details:\nNot Enough frames collected: ' 'benchmarkLive ${benchmarkLiveResult['frameCount']}, ' diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index 3811adf504..9f9bc8b316 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -112,6 +112,9 @@ Future run(List arguments) async { printProgress('Trailing spaces...'); await verifyNoTrailingSpaces(flutterRoot); // assumes no unexpected binaries, so should be after verifyNoBinaries + printProgress('Spaces after flow control statements...'); + await verifySpacesAfterFlowControlStatements(flutterRoot); + printProgress('Deprecations...'); await verifyDeprecations(flutterRoot); @@ -1040,6 +1043,38 @@ Future verifyNoTrailingSpaces(String workingDirectory, { int minimumMatche } } +final RegExp _flowControlStatementWithoutSpace = RegExp(r'(^|[ \t])(if|switch|for|do|while|catch)\(', multiLine: true); + +Future verifySpacesAfterFlowControlStatements(String workingDirectory, { int minimumMatches = 4000 }) async { + const Set extensions = { + '.dart', + '.java', + '.js', + '.kt', + '.swift', + '.c', + '.cc', + '.cpp', + '.h', + '.m', + }; + final List files = await _allFiles(workingDirectory, null, minimumMatches: minimumMatches) + .where((File file) => extensions.contains(path.extension(file.path))) + .toList(); + final List problems = []; + for (final File file in files) { + final List lines = file.readAsLinesSync(); + for (int index = 0; index < lines.length; index += 1) { + if (lines[index].contains(_flowControlStatementWithoutSpace)) { + problems.add('${file.path}:${index + 1}: no space after flow control statement'); + } + } + } + if (problems.isNotEmpty) { + foundError(problems); + } +} + String _bullets(String value) => ' * $value'; Future verifyIssueLinks(String workingDirectory) async { diff --git a/dev/bots/test/analyze-test-input/root/packages/foo/spaces_after_flow.dart b/dev/bots/test/analyze-test-input/root/packages/foo/spaces_after_flow.dart new file mode 100644 index 0000000000..97705b7885 --- /dev/null +++ b/dev/bots/test/analyze-test-input/root/packages/foo/spaces_after_flow.dart @@ -0,0 +1,37 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// ignore_for_file: type=lint + +bool isThereMeaningOfLife = true; + +void main() { + if (isThereMeaningOfLife) {} + if(isThereMeaningOfLife) {} + //^ + + switch (isThereMeaningOfLife) { + case false: + case true: + } + switch(isThereMeaningOfLife) { + // ^ + case false: + case true: + } + + for (int index = 0; index < 10; index++) {} + for(int index = 0; index < 10; index++) {} + // ^ + + while (isThereMeaningOfLife) {} + while(isThereMeaningOfLife) {} + // ^ + + try { + } catch (e) {} + try { + } catch(e) {} + // ^ +} diff --git a/dev/bots/test/analyze_test.dart b/dev/bots/test/analyze_test.dart index 9edaf41ede..f406f2ae44 100644 --- a/dev/bots/test/analyze_test.dart +++ b/dev/bots/test/analyze_test.dart @@ -124,6 +124,24 @@ void main() { ); }); + test('analyze.dart - verifySpacesAfterFlowControlStatements', () async { + final String result = await capture(() => verifySpacesAfterFlowControlStatements(testRootPath, minimumMatches: 2), shouldHaveErrors: true); + final String lines = [ + '║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:11: no space after flow control statement', + '║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:18: no space after flow control statement', + '║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:25: no space after flow control statement', + '║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:29: no space after flow control statement', + '║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:35: no space after flow control statement', + ] + .map((String line) => line.replaceAll('/', Platform.isWindows ? r'\' : '/')) + .join('\n'); + expect(result, + '╔═╡ERROR╞═══════════════════════════════════════════════════════════════════════\n' + '$lines\n' + '╚═══════════════════════════════════════════════════════════════════════════════\n' + ); + }); + test('analyze.dart - verifyNoBinaries - positive', () async { final String result = await capture(() => verifyNoBinaries( testRootPath, diff --git a/dev/devicelab/bin/summarize.dart b/dev/devicelab/bin/summarize.dart index 2a3b28aa4e..d11d0f3bc3 100644 --- a/dev/devicelab/bin/summarize.dart +++ b/dev/devicelab/bin/summarize.dart @@ -44,7 +44,7 @@ Future main(List rawArgs) async { test = ABTest.fromJsonMap( const JsonDecoder().convert(await file.readAsString()) as Map ); - } catch(error) { + } catch (error) { _usage('Could not parse json file "$filename"'); return; } diff --git a/dev/devicelab/lib/framework/devices.dart b/dev/devicelab/lib/framework/devices.dart index 157f50100e..2720dd9689 100644 --- a/dev/devicelab/lib/framework/devices.dart +++ b/dev/devicelab/lib/framework/devices.dart @@ -36,7 +36,7 @@ String getArtifactPath() { String? _findMatchId(List idList, String idPattern) { String? candidate; idPattern = idPattern.toLowerCase(); - for(final String id in idList) { + for (final String id in idList) { if (id.toLowerCase() == idPattern) { return id; } diff --git a/dev/devicelab/lib/tasks/plugin_tests.dart b/dev/devicelab/lib/tasks/plugin_tests.dart index 259a9c105c..4ef09183a8 100644 --- a/dev/devicelab/lib/tasks/plugin_tests.dart +++ b/dev/devicelab/lib/tasks/plugin_tests.dart @@ -252,7 +252,7 @@ public class $pluginClass: NSObject, FlutterPlugin { // build files. await build(buildTarget, validateNativeBuildProject: false); - switch(buildTarget) { + switch (buildTarget) { case 'apk': if (await exec( path.join('.', 'gradlew'), diff --git a/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java b/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java index 39ae4eb28d..9472fa58ca 100644 --- a/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java +++ b/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java @@ -47,7 +47,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho @Override public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { - switch(methodCall.method) { + switch (methodCall.method) { case "pipeFlutterViewEvents": result.success(null); return; diff --git a/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java b/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java index ac00419edd..8d7a64493d 100644 --- a/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java +++ b/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java @@ -49,7 +49,7 @@ public class SimplePlatformView implements PlatformView, MethodChannel.MethodCal @Override public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { - switch(methodCall.method) { + switch (methodCall.method) { case "pipeTouchEvents": touchPipe.enable(); result.success(null); diff --git a/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java b/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java index 2ebf9d25a8..6ff06ab193 100644 --- a/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java +++ b/dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java @@ -31,7 +31,7 @@ class TouchPipe implements View.OnTouchListener { } public void disable() { - if(!mEnabled) + if (!mEnabled) return; mEnabled = false; mView.setOnTouchListener(null); diff --git a/dev/integration_tests/android_views/lib/motion_events_page.dart b/dev/integration_tests/android_views/lib/motion_events_page.dart index 7978a32e2c..1b4f6cc6a2 100644 --- a/dev/integration_tests/android_views/lib/motion_events_page.dart +++ b/dev/integration_tests/android_views/lib/motion_events_page.dart @@ -162,7 +162,7 @@ class MotionEventsBodyState extends State { diff.write(currentDiff); } return diff.toString(); - } catch(e) { + } catch (e) { return e.toString(); } } diff --git a/dev/integration_tests/android_views/lib/wm_integrations.dart b/dev/integration_tests/android_views/lib/wm_integrations.dart index 29ce12d132..2a730efa96 100644 --- a/dev/integration_tests/android_views/lib/wm_integrations.dart +++ b/dev/integration_tests/android_views/lib/wm_integrations.dart @@ -111,7 +111,7 @@ class WindowManagerBodyState extends State { setState(() { _lastTestStatus = _LastTestStatus.success; }); - } catch(e) { + } catch (e) { setState(() { _lastTestStatus = _LastTestStatus.error; lastError = '$e'; @@ -125,7 +125,7 @@ class WindowManagerBodyState extends State { setState(() { windowClickCount++; }); - } catch(e) { + } catch (e) { setState(() { _lastTestStatus = _LastTestStatus.error; lastError = '$e'; diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/leave_behind_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/leave_behind_demo.dart index 5a87252e8b..f0ac7086d4 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/leave_behind_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/leave_behind_demo.dart @@ -224,7 +224,7 @@ class _LeaveBehindListItem extends StatelessWidget { } }, confirmDismiss: !confirmDismiss ? null : (DismissDirection dismissDirection) async { - switch(dismissDirection) { + switch (dismissDirection) { case DismissDirection.endToStart: return await _showConfirmationDialog(context, 'archive') ?? false; case DismissDirection.startToEnd: diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart index e96d792966..fdf9d9705f 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart @@ -72,7 +72,7 @@ class ScrollableTabsDemoState extends State with SingleTicke return const UnderlineTabIndicator(); } - switch(_demoStyle) { + switch (_demoStyle) { case TabsDemoStyle.iconsAndText: return ShapeDecoration( shape: const RoundedRectangleBorder( diff --git a/dev/integration_tests/flutter_gallery/test_driver/transitions_perf.dart b/dev/integration_tests/flutter_gallery/test_driver/transitions_perf.dart index dfef691719..04b783f88f 100644 --- a/dev/integration_tests/flutter_gallery/test_driver/transitions_perf.dart +++ b/dev/integration_tests/flutter_gallery/test_driver/transitions_perf.dart @@ -26,7 +26,7 @@ Set _unTestedDemos = Set.from(_allDemos); class _MessageHandler { static LiveWidgetController? controller; Future call(String message) async { - switch(message) { + switch (message) { case 'demoNames': return const JsonEncoder.withIndent(' ').convert(_allDemos); case 'profileDemos': diff --git a/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java b/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java index 100f98dd3d..2e5b6199ba 100644 --- a/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java +++ b/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java @@ -110,7 +110,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho @Override public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { - switch(methodCall.method) { + switch (methodCall.method) { case "getStoragePermission": if (permissionResult != null) { result.error("error", "already waiting for permissions", null); diff --git a/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java b/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java index e90a464c6b..4f88e4a238 100644 --- a/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java +++ b/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java @@ -50,7 +50,7 @@ public class SimplePlatformView implements PlatformView, MethodChannel.MethodCal @Override public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { - switch(methodCall.method) { + switch (methodCall.method) { case "pipeTouchEvents": touchPipe.enable(); result.success(null); diff --git a/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java b/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java index 2ebf9d25a8..6ff06ab193 100644 --- a/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java +++ b/dev/integration_tests/hybrid_android_views/android/app/src/main/java/io/flutter/integration/androidviews/TouchPipe.java @@ -31,7 +31,7 @@ class TouchPipe implements View.OnTouchListener { } public void disable() { - if(!mEnabled) + if (!mEnabled) return; mEnabled = false; mView.setOnTouchListener(null); diff --git a/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart b/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart index fd405379c0..ad50892a34 100644 --- a/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart +++ b/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart @@ -144,7 +144,7 @@ class MotionEventsBodyState extends State { diff.write(currentDiff); } return diff.toString(); - } catch(e) { + } catch (e) { return e.toString(); } } diff --git a/dev/integration_tests/hybrid_android_views/lib/nested_view_event_page.dart b/dev/integration_tests/hybrid_android_views/lib/nested_view_event_page.dart index dffbe73853..bdcb3dd906 100644 --- a/dev/integration_tests/hybrid_android_views/lib/nested_view_event_page.dart +++ b/dev/integration_tests/hybrid_android_views/lib/nested_view_event_page.dart @@ -145,7 +145,7 @@ class NestedViewEventBodyState extends State { setState(() { _lastTestStatus = _LastTestStatus.success; }); - } catch(e) { + } catch (e) { setState(() { _lastTestStatus = _LastTestStatus.error; lastError = '$e'; @@ -165,7 +165,7 @@ class NestedViewEventBodyState extends State { setState(() { nestedViewClickCount++; }); - } catch(e) { + } catch (e) { setState(() { _lastTestStatus = _LastTestStatus.error; lastError = '$e'; diff --git a/dev/tools/gen_defaults/lib/input_decorator_template.dart b/dev/tools/gen_defaults/lib/input_decorator_template.dart index ca2db97ea5..b5daa3bb60 100644 --- a/dev/tools/gen_defaults/lib/input_decorator_template.dart +++ b/dev/tools/gen_defaults/lib/input_decorator_template.dart @@ -91,7 +91,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme { if (states.contains(MaterialState.disabled)) { return ${componentColor('md.comp.filled-text-field.disabled.leading-icon')}; } - if(states.contains(MaterialState.error)) { + if (states.contains(MaterialState.error)) { if (states.contains(MaterialState.hovered)) { return ${componentColor('md.comp.filled-text-field.error.hover.leading-icon')}; } @@ -114,7 +114,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme { if (states.contains(MaterialState.disabled)) { return ${componentColor('md.comp.filled-text-field.disabled.trailing-icon')}; } - if(states.contains(MaterialState.error)) {${componentColor('md.comp.filled-text-field.error.trailing-icon') == componentColor('md.comp.filled-text-field.error.focus.trailing-icon') ? '' : ''' + if (states.contains(MaterialState.error)) {${componentColor('md.comp.filled-text-field.error.trailing-icon') == componentColor('md.comp.filled-text-field.error.focus.trailing-icon') ? '' : ''' if (states.contains(MaterialState.hovered)) { return ${componentColor('md.comp.filled-text-field.error.hover.trailing-icon')}; } @@ -138,7 +138,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme { if (states.contains(MaterialState.disabled)) { return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.disabled.label-text')}); } - if(states.contains(MaterialState.error)) { + if (states.contains(MaterialState.error)) { if (states.contains(MaterialState.hovered)) { return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.error.hover.label-text')}); } @@ -162,7 +162,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme { if (states.contains(MaterialState.disabled)) { return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.disabled.label-text')}); } - if(states.contains(MaterialState.error)) { + if (states.contains(MaterialState.error)) { if (states.contains(MaterialState.hovered)) { return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.error.hover.label-text')}); } diff --git a/packages/flutter/lib/src/cupertino/date_picker.dart b/packages/flutter/lib/src/cupertino/date_picker.dart index c889ca685f..9a8768e58c 100644 --- a/packages/flutter/lib/src/cupertino/date_picker.dart +++ b/packages/flutter/lib/src/cupertino/date_picker.dart @@ -2078,7 +2078,7 @@ class _CupertinoTimerPickerState extends State { double maxWidth = double.negativeInfinity; for (int i = 0; i < labels.length; i++) { final String? label = labels[i]; - if(label == null) { + if (label == null) { continue; } diff --git a/packages/flutter/lib/src/cupertino/radio.dart b/packages/flutter/lib/src/cupertino/radio.dart index 342b38b44e..b10c618981 100644 --- a/packages/flutter/lib/src/cupertino/radio.dart +++ b/packages/flutter/lib/src/cupertino/radio.dart @@ -236,7 +236,7 @@ class _CupertinoRadioState extends State> with TickerProvid final bool? accessibilitySelected; // Apple devices also use `selected` to annotate radio button's semantics // state. - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.linux: diff --git a/packages/flutter/lib/src/cupertino/scrollbar.dart b/packages/flutter/lib/src/cupertino/scrollbar.dart index a2c8b965bc..033b748184 100644 --- a/packages/flutter/lib/src/cupertino/scrollbar.dart +++ b/packages/flutter/lib/src/cupertino/scrollbar.dart @@ -212,7 +212,7 @@ class _CupertinoScrollbarState extends RawScrollbarState { } _thicknessAnimationController.reverse(); super.handleThumbPressEnd(localPosition, velocity); - switch(direction) { + switch (direction) { case Axis.vertical: if (velocity.pixelsPerSecond.dy.abs() < 10 && (localPosition.dy - _pressStartAxisPosition).abs() > 0) { diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart index 70c1702b7f..2057e115a2 100644 --- a/packages/flutter/lib/src/cupertino/switch.dart +++ b/packages/flutter/lib/src/cupertino/switch.dart @@ -577,7 +577,7 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox { bool get isFocused => _isFocused; bool _isFocused; set isFocused(bool value) { - if(value == _isFocused) { + if (value == _isFocused) { return; } _isFocused = value; @@ -637,7 +637,7 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox { final RRect trackRRect = RRect.fromRectAndRadius(trackRect, const Radius.circular(_kTrackRadius)); canvas.drawRRect(trackRRect, paint); - if(_isFocused) { + if (_isFocused) { // Paints a border around the switch in the focus color. final RRect borderTrackRRect = trackRRect.inflate(1.75); diff --git a/packages/flutter/lib/src/foundation/change_notifier.dart b/packages/flutter/lib/src/foundation/change_notifier.dart index 7883dbb89a..0b8c6f4ae9 100644 --- a/packages/flutter/lib/src/foundation/change_notifier.dart +++ b/packages/flutter/lib/src/foundation/change_notifier.dart @@ -443,7 +443,7 @@ mixin class ChangeNotifier implements Listenable { if (_listeners[i] == null) { // We swap this item with the next not null item. int swapIndex = i + 1; - while(_listeners[swapIndex] == null) { + while (_listeners[swapIndex] == null) { swapIndex += 1; } _listeners[i] = _listeners[swapIndex]; diff --git a/packages/flutter/lib/src/gestures/monodrag.dart b/packages/flutter/lib/src/gestures/monodrag.dart index 7aaba012c8..5af8642244 100644 --- a/packages/flutter/lib/src/gestures/monodrag.dart +++ b/packages/flutter/lib/src/gestures/monodrag.dart @@ -451,7 +451,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { @override void didStopTrackingLastPointer(int pointer) { assert(_state != _DragState.ready); - switch(_state) { + switch (_state) { case _DragState.ready: break; diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index 3b59572a99..c42d5daa63 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -324,7 +324,7 @@ class _BottomSheetState extends State { void _handleDragHandleHover(bool hovering) { if (hovering != dragHandleMaterialState.contains(MaterialState.hovered)) { setState(() { - if(hovering){ + if (hovering){ dragHandleMaterialState.add(MaterialState.hovered); } else{ @@ -360,7 +360,7 @@ class _BottomSheetState extends State { // Only add [GestureDetector] to the drag handle when the rest of the // bottom sheet is not draggable. If the whole bottom sheet is draggable, // no need to add it. - if(!widget.enableDrag) { + if (!widget.enableDrag) { dragHandle = GestureDetector( onVerticalDragStart: _handleDragStart, onVerticalDragUpdate: _handleDragUpdate, diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index 9f3a967bfc..f13b630f3b 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -930,7 +930,7 @@ class _AdaptiveAlertDialog extends AlertDialog { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - switch(theme.platform) { + switch (theme.platform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.linux: diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart index 37a2a4253c..7d641cdfdf 100644 --- a/packages/flutter/lib/src/material/drawer.dart +++ b/packages/flutter/lib/src/material/drawer.dart @@ -502,7 +502,7 @@ class DrawerControllerState extends State with SingleTickerPro _scrimColorTween = _buildScrimColorTween(); } if (widget.isDrawerOpen != oldWidget.isDrawerOpen) { - switch(_controller.status) { + switch (_controller.status) { case AnimationStatus.completed: case AnimationStatus.dismissed: _controller.value = widget.isDrawerOpen ? 1.0 : 0.0; diff --git a/packages/flutter/lib/src/material/expand_icon.dart b/packages/flutter/lib/src/material/expand_icon.dart index 1aa6b2911c..10733d64e0 100644 --- a/packages/flutter/lib/src/material/expand_icon.dart +++ b/packages/flutter/lib/src/material/expand_icon.dart @@ -152,7 +152,7 @@ class _ExpandIconState extends State with SingleTickerProviderStateM return widget.color!; } - switch(Theme.of(context).brightness) { + switch (Theme.of(context).brightness) { case Brightness.light: return Colors.black54; case Brightness.dark: diff --git a/packages/flutter/lib/src/material/floating_action_button.dart b/packages/flutter/lib/src/material/floating_action_button.dart index 8e758d088e..1a580b3366 100644 --- a/packages/flutter/lib/src/material/floating_action_button.dart +++ b/packages/flutter/lib/src/material/floating_action_button.dart @@ -556,7 +556,7 @@ class FloatingActionButton extends StatelessWidget { data: IconThemeData(size: iconSize), child: child!, ) : child; - switch(_floatingActionButtonType) { + switch (_floatingActionButtonType) { case _FloatingActionButtonType.regular: sizeConstraints = floatingActionButtonTheme.sizeConstraints ?? defaults.sizeConstraints!; case _FloatingActionButtonType.small: diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 28d27426e7..39f0185f87 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -4617,7 +4617,7 @@ class _InputDecoratorDefaultsM3 extends InputDecorationTheme { if (states.contains(MaterialState.disabled)) { return _colors.onSurface.withOpacity(0.38); } - if(states.contains(MaterialState.error)) { + if (states.contains(MaterialState.error)) { return _colors.error; } return _colors.onSurfaceVariant; @@ -4629,7 +4629,7 @@ class _InputDecoratorDefaultsM3 extends InputDecorationTheme { if (states.contains(MaterialState.disabled)) { return textStyle.copyWith(color: _colors.onSurface.withOpacity(0.38)); } - if(states.contains(MaterialState.error)) { + if (states.contains(MaterialState.error)) { if (states.contains(MaterialState.hovered)) { return textStyle.copyWith(color: _colors.onErrorContainer); } @@ -4653,7 +4653,7 @@ class _InputDecoratorDefaultsM3 extends InputDecorationTheme { if (states.contains(MaterialState.disabled)) { return textStyle.copyWith(color: _colors.onSurface.withOpacity(0.38)); } - if(states.contains(MaterialState.error)) { + if (states.contains(MaterialState.error)) { if (states.contains(MaterialState.hovered)) { return textStyle.copyWith(color: _colors.onErrorContainer); } diff --git a/packages/flutter/lib/src/material/radio.dart b/packages/flutter/lib/src/material/radio.dart index ae007a7d40..0716763e54 100644 --- a/packages/flutter/lib/src/material/radio.dart +++ b/packages/flutter/lib/src/material/radio.dart @@ -502,7 +502,7 @@ class _RadioState extends State> with TickerProviderStateMixin, Togg final bool? accessibilitySelected; // Apple devices also use `selected` to annotate radio button's semantics // state. - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.linux: diff --git a/packages/flutter/lib/src/material/refresh_indicator.dart b/packages/flutter/lib/src/material/refresh_indicator.dart index f5b625451c..47791c416e 100644 --- a/packages/flutter/lib/src/material/refresh_indicator.dart +++ b/packages/flutter/lib/src/material/refresh_indicator.dart @@ -596,7 +596,7 @@ class RefreshIndicatorState extends State with TickerProviderS color: widget.color, ); - switch(widget._indicatorType) { + switch (widget._indicatorType) { case _IndicatorType.material: return materialIndicator; diff --git a/packages/flutter/lib/src/material/search.dart b/packages/flutter/lib/src/material/search.dart index fabf1cd94e..ab7eee7f49 100644 --- a/packages/flutter/lib/src/material/search.dart +++ b/packages/flutter/lib/src/material/search.dart @@ -538,7 +538,7 @@ class _SearchPageState extends State<_SearchPage> { final String searchFieldLabel = widget.delegate.searchFieldLabel ?? MaterialLocalizations.of(context).searchFieldLabel; Widget? body; - switch(widget.delegate._currentBody) { + switch (widget.delegate._currentBody) { case _SearchBody.suggestions: body = KeyedSubtree( key: const ValueKey<_SearchBody>(_SearchBody.suggestions), diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index d36d6e666d..ec4b56816b 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -1058,7 +1058,7 @@ class _TextFieldState extends State with RestorationMixin implements _effectiveFocusNode.canRequestFocus = _canRequestFocus; if (_effectiveFocusNode.hasFocus && widget.readOnly != oldWidget.readOnly && _isEnabled) { - if(_effectiveController.selection.isCollapsed) { + if (_effectiveController.selection.isCollapsed) { _showSelectionHandles = !widget.readOnly; } } diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index d487a9a72b..1b42f5fcc1 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -2291,7 +2291,7 @@ class _TimePickerDialogState extends State with RestorationMix final MaterialLocalizations localizations = MaterialLocalizations.of(context); final TimeOfDayFormat timeOfDayFormat = localizations.timeOfDayFormat(alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(context)); final double timePickerWidth; - switch(timeOfDayFormat) { + switch (timeOfDayFormat) { case TimeOfDayFormat.HH_colon_mm: case TimeOfDayFormat.HH_dot_mm: case TimeOfDayFormat.frenchCanadian: @@ -2331,7 +2331,7 @@ class _TimePickerDialogState extends State with RestorationMix final MaterialLocalizations localizations = MaterialLocalizations.of(context); final TimeOfDayFormat timeOfDayFormat = localizations.timeOfDayFormat(alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(context)); final double timePickerWidth; - switch(timeOfDayFormat) { + switch (timeOfDayFormat) { case TimeOfDayFormat.HH_colon_mm: case TimeOfDayFormat.HH_dot_mm: case TimeOfDayFormat.frenchCanadian: diff --git a/packages/flutter/lib/src/painting/box_border.dart b/packages/flutter/lib/src/painting/box_border.dart index 10a41c7fbb..dfc9a606a5 100644 --- a/packages/flutter/lib/src/painting/box_border.dart +++ b/packages/flutter/lib/src/painting/box_border.dart @@ -254,7 +254,7 @@ abstract class BoxBorder extends ShapeBorder { required BorderSide bottom, }) { final RRect borderRect; - switch(shape) { + switch (shape) { case BoxShape.rectangle: borderRect = (borderRadius ?? BorderRadius.zero) .resolve(textDirection) @@ -605,7 +605,7 @@ class Border extends BoxBorder { // Allow painting non-uniform borders if the color and style are uniform. if (_colorIsUniform && _styleIsUniform) { - switch(top.style) { + switch (top.style) { case BorderStyle.none: return; case BorderStyle.solid: @@ -964,7 +964,7 @@ class BorderDirectional extends BoxBorder { // Allow painting non-uniform borders if the color and style are uniform. if (_colorIsUniform && _styleIsUniform) { - switch(top.style) { + switch (top.style) { case BorderStyle.none: return; case BorderStyle.solid: diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index ef7ad071df..f3486a13e0 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -1199,7 +1199,7 @@ class TextPainter { // TODO(LongCatIsLooong): make this case impossible; see https://github.com/flutter/flutter/issues/79495 return null; } - return switch(_computeCaretMetrics(position)) { + return switch (_computeCaretMetrics(position)) { _LineCaretMetrics(:final double fullHeight) => fullHeight, _EmptyLineCaretMetrics() => null, }; diff --git a/packages/flutter/lib/src/rendering/layer.dart b/packages/flutter/lib/src/rendering/layer.dart index 8ad458116e..2caade2c2f 100644 --- a/packages/flutter/lib/src/rendering/layer.dart +++ b/packages/flutter/lib/src/rendering/layer.dart @@ -1322,7 +1322,7 @@ class ContainerLayer extends Layer { } final List children = []; Layer? child = firstChild; - while(child != null) { + while (child != null) { children.add(child); if (child is ContainerLayer) { children.addAll(child.depthFirstIterateChildren()); diff --git a/packages/flutter/lib/src/rendering/paragraph.dart b/packages/flutter/lib/src/rendering/paragraph.dart index 25e0d8f3e7..e07283abea 100644 --- a/packages/flutter/lib/src/rendering/paragraph.dart +++ b/packages/flutter/lib/src/rendering/paragraph.dart @@ -1524,7 +1524,7 @@ class _SelectableFragment with Selectable, ChangeNotifier implements TextLayoutM SelectionResult _handleDirectionallyExtendSelection(double horizontalBaseline, bool isExtent, SelectionExtendDirection movement) { final Matrix4 transform = paragraph.getTransformTo(null); if (transform.invert() == 0.0) { - switch(movement) { + switch (movement) { case SelectionExtendDirection.previousLine: case SelectionExtendDirection.backward: return SelectionResult.previous; @@ -1537,7 +1537,7 @@ class _SelectableFragment with Selectable, ChangeNotifier implements TextLayoutM assert(!baselineInParagraphCoordinates.isNaN); final TextPosition newPosition; final SelectionResult result; - switch(movement) { + switch (movement) { case SelectionExtendDirection.previousLine: case SelectionExtendDirection.nextLine: assert(_textSelectionEnd != null && _textSelectionStart != null); diff --git a/packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart b/packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart index eae68dcea6..4fe59a7026 100644 --- a/packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart +++ b/packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart @@ -153,7 +153,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda int _calculateLeadingGarbage(int firstIndex) { RenderBox? walker = firstChild; int leadingGarbage = 0; - while(walker != null && indexOf(walker) < firstIndex) { + while (walker != null && indexOf(walker) < firstIndex) { leadingGarbage += 1; walker = childAfter(walker); } @@ -163,7 +163,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda int _calculateTrailingGarbage(int targetLastIndex) { RenderBox? walker = lastChild; int trailingGarbage = 0; - while(walker != null && indexOf(walker) > targetLastIndex) { + while (walker != null && indexOf(walker) > targetLastIndex) { trailingGarbage += 1; walker = childBefore(walker); } diff --git a/packages/flutter/lib/src/rendering/sliver_group.dart b/packages/flutter/lib/src/rendering/sliver_group.dart index fdf922c018..0ef8402115 100644 --- a/packages/flutter/lib/src/rendering/sliver_group.dart +++ b/packages/flutter/lib/src/rendering/sliver_group.dart @@ -151,7 +151,7 @@ class RenderSliverCrossAxisGroup extends RenderSliver with ContainerRenderObject } bool _assertOutOfExtent(double extent) { - if(extent <= 0.0) { + if (extent <= 0.0) { throw FlutterError.fromParts([ ErrorSummary('SliverCrossAxisGroup ran out of extent before child could be laid out.'), ErrorDescription( diff --git a/packages/flutter/lib/src/rendering/table_border.dart b/packages/flutter/lib/src/rendering/table_border.dart index f40c67bdd5..97f2c6b9e4 100644 --- a/packages/flutter/lib/src/rendering/table_border.dart +++ b/packages/flutter/lib/src/rendering/table_border.dart @@ -250,7 +250,7 @@ class TableBorder { } } } - if(!isUniform || borderRadius == BorderRadius.zero) { + if (!isUniform || borderRadius == BorderRadius.zero) { paintBorder(canvas, rect, top: top, right: right, bottom: bottom, left: left); } else { final RRect outer = borderRadius.toRRect(rect); diff --git a/packages/flutter/lib/src/services/platform_views.dart b/packages/flutter/lib/src/services/platform_views.dart index 5c5c0a6ada..f8ffe586b0 100644 --- a/packages/flutter/lib/src/services/platform_views.dart +++ b/packages/flutter/lib/src/services/platform_views.dart @@ -72,7 +72,7 @@ class PlatformViewsService { static final PlatformViewsService _instance = PlatformViewsService._(); Future _onMethodCall(MethodCall call) { - switch(call.method) { + switch (call.method) { case 'viewFocused': final int id = call.arguments as int; if (_focusCallbacks.containsKey(id)) { diff --git a/packages/flutter/lib/src/widgets/animated_scroll_view.dart b/packages/flutter/lib/src/widgets/animated_scroll_view.dart index 7dda551ae4..a855571903 100644 --- a/packages/flutter/lib/src/widgets/animated_scroll_view.dart +++ b/packages/flutter/lib/src/widgets/animated_scroll_view.dart @@ -1137,7 +1137,7 @@ abstract class _SliverAnimatedMultiBoxAdaptorState= 0; i--) { + for (int i = _itemsCount - 1 ; i >= 0; i--) { removeItem(i, builder, duration: duration); } } diff --git a/packages/flutter/lib/src/widgets/dismissible.dart b/packages/flutter/lib/src/widgets/dismissible.dart index d80f8bc94f..87f9753511 100644 --- a/packages/flutter/lib/src/widgets/dismissible.dart +++ b/packages/flutter/lib/src/widgets/dismissible.dart @@ -439,7 +439,7 @@ class _DismissibleState extends State with TickerProviderStateMixin } void _handleDismissUpdateValueChanged() { - if(widget.onUpdate != null) { + if (widget.onUpdate != null) { final bool oldDismissThresholdReached = _dismissThresholdReached; _dismissThresholdReached = _moveController!.value > (widget.dismissThresholds[_dismissDirection] ?? _kDismissThreshold); final DismissUpdateDetails details = DismissUpdateDetails( diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index d6c2ff2a30..51e2faebfe 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -2896,7 +2896,7 @@ class EditableTextState extends State with AutomaticKeepAliveClien _floatingCursorResetController ??= AnimationController( vsync: this, )..addListener(_onFloatingCursorResetTick); - switch(point.state) { + switch (point.state) { case FloatingCursorDragState.Start: if (_floatingCursorResetController!.isAnimating) { _floatingCursorResetController!.stop(); diff --git a/packages/flutter/lib/src/widgets/form.dart b/packages/flutter/lib/src/widgets/form.dart index 5ae7e57916..76e8521ab9 100644 --- a/packages/flutter/lib/src/widgets/form.dart +++ b/packages/flutter/lib/src/widgets/form.dart @@ -250,7 +250,7 @@ class FormState extends State
{ errorMessage += field.errorText ?? ''; } - if(errorMessage.isNotEmpty) { + if (errorMessage.isNotEmpty) { final TextDirection directionality = Directionality.of(context); if (defaultTargetPlatform == TargetPlatform.iOS) { unawaited(Future(() async { diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart index d90cbc00c9..4c1ec7321a 100644 --- a/packages/flutter/lib/src/widgets/image.dart +++ b/packages/flutter/lib/src/widgets/image.dart @@ -1117,7 +1117,7 @@ class _ImageState extends State with WidgetsBindingObserver { ImageStreamListener? _imageStreamListener; ImageStreamListener _getListener({bool recreateListener = false}) { - if(_imageStreamListener == null || recreateListener) { + if (_imageStreamListener == null || recreateListener) { _lastException = null; _lastStack = null; _imageStreamListener = ImageStreamListener( diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index 21ebd8583d..f9fd981bb4 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -958,10 +958,10 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState { @override void forEachTween(TweenVisitor visitor) { _alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?; - if(widget.heightFactor != null) { + if (widget.heightFactor != null) { _heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween(begin: value as double)) as Tween?; } - if(widget.widthFactor != null) { + if (widget.widthFactor != null) { _widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween(begin: value as double)) as Tween?; } } @@ -2171,10 +2171,10 @@ class _AnimatedFractionallySizedBoxState extends AnimatedWidgetBaseState visitor) { _alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?; - if(widget.heightFactor != null) { + if (widget.heightFactor != null) { _heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween(begin: value as double)) as Tween?; } - if(widget.widthFactor != null) { + if (widget.widthFactor != null) { _widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween(begin: value as double)) as Tween?; } } diff --git a/packages/flutter/lib/src/widgets/interactive_viewer.dart b/packages/flutter/lib/src/widgets/interactive_viewer.dart index 10adbeebf5..ce0ed3111d 100644 --- a/packages/flutter/lib/src/widgets/interactive_viewer.dart +++ b/packages/flutter/lib/src/widgets/interactive_viewer.dart @@ -608,7 +608,7 @@ class _InteractiveViewerState extends State with TickerProvid late final Offset alignedTranslation; if (_currentAxis != null) { - switch(widget.panAxis){ + switch (widget.panAxis){ case PanAxis.horizontal: alignedTranslation = _alignAxis(translation, Axis.horizontal); case PanAxis.vertical: diff --git a/packages/flutter/lib/src/widgets/modal_barrier.dart b/packages/flutter/lib/src/widgets/modal_barrier.dart index f831c2089d..f2a247a7d3 100644 --- a/packages/flutter/lib/src/widgets/modal_barrier.dart +++ b/packages/flutter/lib/src/widgets/modal_barrier.dart @@ -70,7 +70,7 @@ class _RenderSemanticsClipper extends RenderProxyBox { if (_clipDetailsNotifier == newNotifier) { return; } - if(attached) { + if (attached) { _clipDetailsNotifier.removeListener(markNeedsSemanticsUpdate); } _clipDetailsNotifier = newNotifier; diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index a176892d99..5800782956 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -3722,7 +3722,7 @@ class NavigatorState extends State with TickerProviderStateMixin, Res // We found the page for all the consecutive pageless routes below. Attach these // pageless routes to the page. - if(unattachedPagelessRoutes.isNotEmpty) { + if (unattachedPagelessRoutes.isNotEmpty) { pageRouteToPagelessRoutes.putIfAbsent( oldEntry, () => List<_RouteEntry>.from(unattachedPagelessRoutes), @@ -4113,7 +4113,7 @@ class NavigatorState extends State with TickerProviderStateMixin, Res } int _getIndexBefore(int index, _RouteEntryPredicate predicate) { - while(index >= 0 && !predicate(_history[index])) { + while (index >= 0 && !predicate(_history[index])) { index -= 1; } return index; @@ -5013,7 +5013,7 @@ class NavigatorState extends State with TickerProviderStateMixin, Res /// {@end-tool} void popUntil(RoutePredicate predicate) { _RouteEntry? candidate = _lastRouteEntryWhereOrNull(_RouteEntry.isPresentPredicate); - while(candidate != null) { + while (candidate != null) { if (predicate(candidate.route)) { return; } diff --git a/packages/flutter/lib/src/widgets/overlay.dart b/packages/flutter/lib/src/widgets/overlay.dart index af980618c1..aad2536a27 100644 --- a/packages/flutter/lib/src/widgets/overlay.dart +++ b/packages/flutter/lib/src/widgets/overlay.dart @@ -303,7 +303,7 @@ class _OverlayEntryWidgetState extends State<_OverlayEntryWidget> { return; } _OverlayEntryLocation? candidate = reversed ? children.last : children.first; - while(candidate != null) { + while (candidate != null) { final RenderBox? renderBox = candidate._overlayChildRenderBox; candidate = reversed ? candidate.previous : candidate.next; if (renderBox != null) { @@ -912,7 +912,7 @@ class _RenderTheater extends RenderBox with ContainerRenderObjectMixin? iterator = childParentData.paintOrderIterator; if (iterator != null) { - while(iterator.moveNext()) { + while (iterator.moveNext()) { iterator.current.attach(owner); } } diff --git a/packages/flutter/lib/src/widgets/scroll_activity.dart b/packages/flutter/lib/src/widgets/scroll_activity.dart index 01a29558e3..64376b7dd5 100644 --- a/packages/flutter/lib/src/widgets/scroll_activity.dart +++ b/packages/flutter/lib/src/widgets/scroll_activity.dart @@ -404,7 +404,7 @@ class ScrollDragController implements Drag { // substantially lower than the carried momentum. final bool isVelocityNotSubstantiallyLessThanCarriedMomentum = velocity.abs() > carriedVelocity!.abs() * momentumRetainVelocityThresholdFactor; - if(isFlingingInSameDirection && isVelocityNotSubstantiallyLessThanCarriedMomentum) { + if (isFlingingInSameDirection && isVelocityNotSubstantiallyLessThanCarriedMomentum) { velocity += carriedVelocity!; } } diff --git a/packages/flutter/lib/src/widgets/scrollbar.dart b/packages/flutter/lib/src/widgets/scrollbar.dart index 24ae147815..cf5e3697b1 100644 --- a/packages/flutter/lib/src/widgets/scrollbar.dart +++ b/packages/flutter/lib/src/widgets/scrollbar.dart @@ -261,7 +261,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter { OutlinedBorder? _shape; set shape(OutlinedBorder? value){ assert(radius == null || value == null); - if(shape == value) { + if (shape == value) { return; } @@ -384,7 +384,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter { // The track is offset by only padding. double get _totalTrackMainAxisOffsets => _isVertical ? padding.vertical : padding.horizontal; double get _leadingTrackMainAxisOffset { - switch(_resolvedOrientation) { + switch (_resolvedOrientation) { case ScrollbarOrientation.left: case ScrollbarOrientation.right: return padding.top; @@ -402,7 +402,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter { // Thumb Offsets // The thumb is offset by padding and margins. double get _leadingThumbMainAxisOffset { - switch(_resolvedOrientation) { + switch (_resolvedOrientation) { case ScrollbarOrientation.left: case ScrollbarOrientation.right: return padding.top + mainAxisMargin; @@ -558,7 +558,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter { final Size thumbSize, trackSize; final Offset trackOffset, borderStart, borderEnd; _debugAssertIsValidOrientation(_resolvedOrientation); - switch(_resolvedOrientation) { + switch (_resolvedOrientation) { case ScrollbarOrientation.left: thumbSize = Size(thickness, _thumbExtent); trackSize = Size(thickness + 2 * crossAxisMargin, _trackExtent); @@ -1711,7 +1711,7 @@ class RawScrollbarState extends State with TickerProv // The physics may allow overscroll when actually *scrolling*, but // dragging on the scrollbar does not always allow us to enter overscroll. - switch(ScrollConfiguration.of(context).getPlatform(context)) { + switch (ScrollConfiguration.of(context).getPlatform(context)) { case TargetPlatform.fuchsia: case TargetPlatform.linux: case TargetPlatform.macOS: @@ -2133,7 +2133,7 @@ class RawScrollbarState extends State with TickerProv gestures: _gestures, child: MouseRegion( onExit: (PointerExitEvent event) { - switch(event.kind) { + switch (event.kind) { case PointerDeviceKind.mouse: case PointerDeviceKind.trackpad: if (enableGestures) { @@ -2147,7 +2147,7 @@ class RawScrollbarState extends State with TickerProv } }, onHover: (PointerHoverEvent event) { - switch(event.kind) { + switch (event.kind) { case PointerDeviceKind.mouse: case PointerDeviceKind.trackpad: if (enableGestures) { diff --git a/packages/flutter/lib/src/widgets/selectable_region.dart b/packages/flutter/lib/src/widgets/selectable_region.dart index 6e6c639892..5aea500ec0 100644 --- a/packages/flutter/lib/src/widgets/selectable_region.dart +++ b/packages/flutter/lib/src/widgets/selectable_region.dart @@ -399,7 +399,7 @@ class SelectableRegionState extends State with TextSelectionDe void _updateSelectionStatus() { final TextSelection selection; final SelectionGeometry geometry = _selectionDelegate.value; - switch(geometry.status) { + switch (geometry.status) { case SelectionStatus.uncollapsed: case SelectionStatus.collapsed: selection = const TextSelection(baseOffset: 0, extentOffset: 1); @@ -1961,7 +1961,7 @@ abstract class MultiSelectableSelectionContainerDelegate extends SelectionContai SelectionResult handleDirectionallyExtendSelection(DirectionallyExtendSelectionEvent event) { assert((currentSelectionStartIndex == -1) == (currentSelectionEndIndex == -1)); if (currentSelectionStartIndex == -1) { - switch(event.direction) { + switch (event.direction) { case SelectionExtendDirection.previousLine: case SelectionExtendDirection.backward: currentSelectionStartIndex = currentSelectionEndIndex = selectables.length; diff --git a/packages/flutter/lib/src/widgets/text_selection.dart b/packages/flutter/lib/src/widgets/text_selection.dart index 24b15791f3..d27b282a37 100644 --- a/packages/flutter/lib/src/widgets/text_selection.dart +++ b/packages/flutter/lib/src/widgets/text_selection.dart @@ -1178,7 +1178,7 @@ class SelectionOverlay { if (!listEquals(_selectionEndpoints, value)) { markNeedsBuild(); if (_isDraggingEndHandle || _isDraggingStartHandle) { - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: HapticFeedback.selectionClick(); case TargetPlatform.fuchsia: diff --git a/packages/flutter/lib/src/widgets/undo_history.dart b/packages/flutter/lib/src/widgets/undo_history.dart index 7f31738551..48b07d9eb6 100644 --- a/packages/flutter/lib/src/widgets/undo_history.dart +++ b/packages/flutter/lib/src/widgets/undo_history.dart @@ -193,7 +193,7 @@ class UndoHistoryState extends State> with UndoManagerClient { @override void handlePlatformUndo(UndoDirection direction) { - switch(direction) { + switch (direction) { case UndoDirection.undo: undo(); case UndoDirection.redo: diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 6cacf54aa6..28d807d62c 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -1417,7 +1417,7 @@ mixin WidgetInspectorService { pubRootDirectories = pubRootDirectories.map((String directory) => Uri.parse(directory).path).toList(); final Set directorySet = Set.from(pubRootDirectories); - if(_pubRootDirectories != null) { + if (_pubRootDirectories != null) { directorySet.addAll(_pubRootDirectories!); } diff --git a/packages/flutter/test/cupertino/app_test.dart b/packages/flutter/test/cupertino/app_test.dart index 872428b28a..d61df5b38c 100644 --- a/packages/flutter/test/cupertino/app_test.dart +++ b/packages/flutter/test/cupertino/app_test.dart @@ -445,7 +445,7 @@ void main() { const ScrollableDetails details = ScrollableDetails(direction: AxisDirection.down); final Widget child = Container(); - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.iOS: diff --git a/packages/flutter/test/cupertino/text_field_test.dart b/packages/flutter/test/cupertino/text_field_test.dart index 25f6f582c3..5e869ca25e 100644 --- a/packages/flutter/test/cupertino/text_field_test.dart +++ b/packages/flutter/test/cupertino/text_field_test.dart @@ -80,7 +80,7 @@ class PathBoundsMatcher extends Matcher { final List values = [bounds, bounds.top, bounds.left, bounds.right, bounds.bottom]; final Map failedMatcher = {}; - for(int idx = 0; idx < matchers.length; idx++) { + for (int idx = 0; idx < matchers.length; idx++) { if (!(matchers[idx]?.matches(values[idx], matchState) ?? true)) { failedMatcher[matchers[idx]!] = values[idx]; } diff --git a/packages/flutter/test/material/app_test.dart b/packages/flutter/test/material/app_test.dart index d5e66f6987..59ba965cd7 100644 --- a/packages/flutter/test/material/app_test.dart +++ b/packages/flutter/test/material/app_test.dart @@ -1476,7 +1476,7 @@ void main() { ); final Widget child = Container(); - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.iOS: @@ -1522,7 +1522,7 @@ void main() { ); final Widget child = Container(); - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.iOS: diff --git a/packages/flutter/test/material/back_button_test.dart b/packages/flutter/test/material/back_button_test.dart index e8cc090138..afdba078a1 100644 --- a/packages/flutter/test/material/back_button_test.dart +++ b/packages/flutter/test/material/back_button_test.dart @@ -198,7 +198,7 @@ void main() { await tester.pumpAndSettle(); final String? expectedLabel; - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: expectedLabel = 'Back'; case TargetPlatform.fuchsia: @@ -241,7 +241,7 @@ void main() { await tester.pumpAndSettle(); final String? expectedLabel; - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: expectedLabel = 'Close'; case TargetPlatform.fuchsia: diff --git a/packages/flutter/test/material/dialog_test.dart b/packages/flutter/test/material/dialog_test.dart index df5c649323..9b2aebceea 100644 --- a/packages/flutter/test/material/dialog_test.dart +++ b/packages/flutter/test/material/dialog_test.dart @@ -2206,7 +2206,7 @@ void main() { return const AlertDialog(title: Text('Title')); }, ); - } catch(exception) { + } catch (exception) { error = exception; } diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart index 2a3a30caeb..aace340eab 100644 --- a/packages/flutter/test/material/input_decorator_test.dart +++ b/packages/flutter/test/material/input_decorator_test.dart @@ -157,7 +157,7 @@ TextStyle? getIconStyle(WidgetTester tester, IconData icon) { } void main() { - for(final bool useMaterial3 in [true, false]){ + for (final bool useMaterial3 in [true, false]){ testWidgets('InputDecorator input/label text layout', (WidgetTester tester) async { // The label appears above the input text await tester.pumpWidget( @@ -380,7 +380,7 @@ void main() { ); await tester.pumpAndSettle(); expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 56.0)); - if(!useMaterial3) { + if (!useMaterial3) { expect(tester.getTopLeft(find.text('label')).dy, tester.getTopLeft(find.text('hint')).dy); expect(tester.getBottomLeft(find.text('label')).dy, tester.getBottomLeft(find.text('hint')).dy); } @@ -723,7 +723,7 @@ void main() { ); await tester.pumpAndSettle(); expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 56.0)); - if(!useMaterial3) { + if (!useMaterial3) { expect(tester.getTopLeft(find.byKey(key)).dy, tester.getTopLeft(find.text('hint')).dy); expect(tester.getBottomLeft(find.byKey(key)).dy, tester.getBottomLeft(find.text('hint')).dy); } diff --git a/packages/flutter/test/material/navigation_drawer_test.dart b/packages/flutter/test/material/navigation_drawer_test.dart index a9c69f2dd6..fd82e7bac8 100644 --- a/packages/flutter/test/material/navigation_drawer_test.dart +++ b/packages/flutter/test/material/navigation_drawer_test.dart @@ -160,7 +160,7 @@ void main() { scaffoldKey, NavigationDrawer( children: [ - for(int i = 0; i < 100; i++) + for (int i = 0; i < 100; i++) NavigationDrawerDestination( icon: const Icon(Icons.ac_unit), label: Text('Label$i'), @@ -213,7 +213,7 @@ void main() { key: scaffoldKey, drawer: NavigationDrawer( children: [ - for(int i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) NavigationDrawerDestination( icon: const Icon(Icons.ac_unit), label: Text('Label$i'), diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 9f96b9c592..d67c91f1ec 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -2081,7 +2081,7 @@ void main() { Widget buildApp() { final PageTransitionsTheme pageTransitionTheme = PageTransitionsTheme( builders: { - for(final TargetPlatform platform in TargetPlatform.values) + for (final TargetPlatform platform in TargetPlatform.values) platform: const CupertinoPageTransitionsBuilder(), }, ); diff --git a/packages/flutter/test/material/stepper_test.dart b/packages/flutter/test/material/stepper_test.dart index 08aa0af729..3fd1a817b8 100644 --- a/packages/flutter/test/material/stepper_test.dart +++ b/packages/flutter/test/material/stepper_test.dart @@ -931,7 +931,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async testWidgets('Vertical and Horizontal Stepper physics test', (WidgetTester tester) async { const ScrollPhysics physics = NeverScrollableScrollPhysics(); - for(final StepperType type in StepperType.values) { + for (final StepperType type in StepperType.values) { await tester.pumpWidget( MaterialApp( home: Material( diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart index 73c61f3132..3aabe0f4e9 100644 --- a/packages/flutter/test/material/text_field_test.dart +++ b/packages/flutter/test/material/text_field_test.dart @@ -16183,9 +16183,9 @@ void main() { await click(find.text('Outside')); - switch(pointerDeviceKind) { + switch (pointerDeviceKind) { case PointerDeviceKind.touch: - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.iOS: case TargetPlatform.android: case TargetPlatform.fuchsia: diff --git a/packages/flutter/test/rendering/stack_test.dart b/packages/flutter/test/rendering/stack_test.dart index 0620712fe0..5edbb8f1e8 100644 --- a/packages/flutter/test/rendering/stack_test.dart +++ b/packages/flutter/test/rendering/stack_test.dart @@ -70,7 +70,7 @@ void main() { final TestClipPaintingContext context = TestClipPaintingContext(); final RenderBox child = box200x200; final RenderStack stack; - switch(clip){ + switch (clip){ case Clip.none: case Clip.hardEdge: case Clip.antiAlias: diff --git a/packages/flutter/test/rendering/wrap_test.dart b/packages/flutter/test/rendering/wrap_test.dart index be37be7813..7cc224b104 100644 --- a/packages/flutter/test/rendering/wrap_test.dart +++ b/packages/flutter/test/rendering/wrap_test.dart @@ -210,7 +210,7 @@ void main() { for (final Clip? clip in [null, ...Clip.values]) { final RenderWrap wrap; - switch(clip){ + switch (clip){ case Clip.none: case Clip.hardEdge: case Clip.antiAlias: diff --git a/packages/flutter/test/services/fake_platform_views.dart b/packages/flutter/test/services/fake_platform_views.dart index 0492abea84..0cf5f36776 100644 --- a/packages/flutter/test/services/fake_platform_views.dart +++ b/packages/flutter/test/services/fake_platform_views.dart @@ -188,7 +188,7 @@ class FakeAndroidPlatformViewsController { } Future _onMethodCall(MethodCall call) { - switch(call.method) { + switch (call.method) { case 'create': return _create(call); case 'dispose': @@ -400,7 +400,7 @@ class FakeIosPlatformViewsController { } Future _onMethodCall(MethodCall call) { - switch(call.method) { + switch (call.method) { case 'create': return _create(call); case 'dispose': @@ -490,7 +490,7 @@ class FakeHtmlPlatformViewsController { } Future _onMethodCall(MethodCall call) { - switch(call.method) { + switch (call.method) { case 'create': return _create(call); case 'dispose': diff --git a/packages/flutter/test/widgets/animated_size_test.dart b/packages/flutter/test/widgets/animated_size_test.dart index 9d2a5cb29c..1e70d3446b 100644 --- a/packages/flutter/test/widgets/animated_size_test.dart +++ b/packages/flutter/test/widgets/animated_size_test.dart @@ -286,7 +286,7 @@ void main() { final RenderAnimatedSize renderObject = tester.renderObject(find.byType(AnimatedSize)); expect(renderObject.clipBehavior, equals(Clip.hardEdge)); - for(final Clip clip in Clip.values) { + for (final Clip clip in Clip.values) { await tester.pumpWidget( Center( child: AnimatedSize( diff --git a/packages/flutter/test/widgets/basic_test.dart b/packages/flutter/test/widgets/basic_test.dart index 4a986785ff..8b35975b57 100644 --- a/packages/flutter/test/widgets/basic_test.dart +++ b/packages/flutter/test/widgets/basic_test.dart @@ -607,7 +607,7 @@ void main() { // Defaults to Clip.none expect(renderObject.clipBehavior, equals(clip ?? Clip.none), reason: 'for clip = $clip'); - switch(clip) { + switch (clip) { case null: case Clip.none: // the UnconstrainedBox overflows. diff --git a/packages/flutter/test/widgets/flow_test.dart b/packages/flutter/test/widgets/flow_test.dart index f84100bde1..0746896d9f 100644 --- a/packages/flutter/test/widgets/flow_test.dart +++ b/packages/flutter/test/widgets/flow_test.dart @@ -172,7 +172,7 @@ void main() { final RenderFlow renderObject = tester.renderObject(find.byType(Flow)); expect(renderObject.clipBehavior, equals(Clip.hardEdge)); - for(final Clip clip in Clip.values) { + for (final Clip clip in Clip.values) { await tester.pumpWidget( Flow( delegate: OpacityFlowDelegate(opacity), @@ -201,7 +201,7 @@ void main() { final RenderFlow renderObject = tester.renderObject(find.byType(Flow)); expect(renderObject.clipBehavior, equals(Clip.hardEdge)); - for(final Clip clip in Clip.values) { + for (final Clip clip in Clip.values) { await tester.pumpWidget( Flow.unwrapped( delegate: OpacityFlowDelegate(opacity), diff --git a/packages/flutter/test/widgets/navigator_test.dart b/packages/flutter/test/widgets/navigator_test.dart index d33d4900d8..d60215ebc8 100644 --- a/packages/flutter/test/widgets/navigator_test.dart +++ b/packages/flutter/test/widgets/navigator_test.dart @@ -384,7 +384,7 @@ void main() { Error? error; try { nav.currentState!.pushNamed('/second'); - } on Error catch(e) { + } on Error catch (e) { error = e; } expect(error, isNull); diff --git a/packages/flutter/test/widgets/overlay_test.dart b/packages/flutter/test/widgets/overlay_test.dart index a8aeeec7a4..abb1d07f31 100644 --- a/packages/flutter/test/widgets/overlay_test.dart +++ b/packages/flutter/test/widgets/overlay_test.dart @@ -1102,7 +1102,7 @@ void main() { bool visited = false; renderObject.visitChildren((RenderObject child) { visited = true; - switch(clip) { + switch (clip) { case Clip.none: expect(renderObject.describeApproximatePaintClip(child), null); case Clip.hardEdge: diff --git a/packages/flutter/test/widgets/scroll_behavior_test.dart b/packages/flutter/test/widgets/scroll_behavior_test.dart index 46c1a40a0b..287a1a82d0 100644 --- a/packages/flutter/test/widgets/scroll_behavior_test.dart +++ b/packages/flutter/test/widgets/scroll_behavior_test.dart @@ -53,7 +53,7 @@ void main() { const ScrollableDetails details = ScrollableDetails(direction: AxisDirection.down); final Widget child = Container(); - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.iOS: diff --git a/packages/flutter/test/widgets/scrollable_test.dart b/packages/flutter/test/widgets/scrollable_test.dart index 7b448a2c1c..366e05896b 100644 --- a/packages/flutter/test/widgets/scrollable_test.dart +++ b/packages/flutter/test/widgets/scrollable_test.dart @@ -366,7 +366,7 @@ void main() { await pumpTest(tester, TargetPlatform.fuchsia, controller: controller); controller.addListener(() { - if(controller.position.userScrollDirection != ScrollDirection.idle) { + if (controller.position.userScrollDirection != ScrollDirection.idle) { lastUserScrollingDirection = controller.position.userScrollDirection; } }); diff --git a/packages/flutter/test/widgets/selectable_region_test.dart b/packages/flutter/test/widgets/selectable_region_test.dart index 362740e79f..21bedecaaf 100644 --- a/packages/flutter/test/widgets/selectable_region_test.dart +++ b/packages/flutter/test/widgets/selectable_region_test.dart @@ -380,7 +380,7 @@ void main() { await gesture.moveTo(endPos); expect(paragraph.selections[0], const TextSelection(baseOffset: 4, extentOffset: 8)); // Only Android vibrate when dragging the handle. - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: expect( log.last, @@ -1273,7 +1273,7 @@ void main() { final bool alt; final bool control; - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.linux: @@ -1381,7 +1381,7 @@ void main() { final bool alt; final bool meta; - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.linux: @@ -1470,7 +1470,7 @@ void main() { final bool alt; final bool meta; - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.linux: @@ -1759,7 +1759,7 @@ void main() { final SelectableRegionState regionState = tester.state(find.byType(SelectableRegion)); // In Android copy should clear the selection. - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.fuchsia: expect(regionState.selectionOverlay, isNull); @@ -1812,7 +1812,7 @@ void main() { final SelectableRegionState regionState = tester.state(find.byType(SelectableRegion)); - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.android: case TargetPlatform.iOS: case TargetPlatform.fuchsia: diff --git a/packages/flutter/test/widgets/semantics_debugger_test.dart b/packages/flutter/test/widgets/semantics_debugger_test.dart index d8889a128c..d5985b933d 100644 --- a/packages/flutter/test/widgets/semantics_debugger_test.dart +++ b/packages/flutter/test/widgets/semantics_debugger_test.dart @@ -325,7 +325,7 @@ void main() { // interpreted as a gesture by the semantics debugger and sent to the widget // as a semantic action that always moves by 10% of the complete track. await tester.fling(find.byType(Slider), const Offset(-100.0, 0.0), 2000.0, warnIfMissed: false); // hitting the debugger - switch(defaultTargetPlatform) { + switch (defaultTargetPlatform) { case TargetPlatform.iOS: case TargetPlatform.macOS: expect(value, equals(0.65)); diff --git a/packages/flutter_driver/lib/src/common/deserialization_factory.dart b/packages/flutter_driver/lib/src/common/deserialization_factory.dart index 97cd532e4b..f020addfa5 100644 --- a/packages/flutter_driver/lib/src/common/deserialization_factory.dart +++ b/packages/flutter_driver/lib/src/common/deserialization_factory.dart @@ -41,7 +41,7 @@ mixin DeserializeCommandFactory { /// Deserializes the finder from JSON generated by [Command.serialize] or [CommandWithTarget.serialize]. Command deserializeCommand(Map params, DeserializeFinderFactory finderFactory) { final String? kind = params['command']; - switch(kind) { + switch (kind) { case 'get_health': return GetHealth.deserialize(params); case 'get_layer_tree': return GetLayerTree.deserialize(params); case 'get_render_tree': return GetRenderTree.deserialize(params); diff --git a/packages/flutter_driver/lib/src/common/handler_factory.dart b/packages/flutter_driver/lib/src/common/handler_factory.dart index 9df581ccc9..def0c660a9 100644 --- a/packages/flutter_driver/lib/src/common/handler_factory.dart +++ b/packages/flutter_driver/lib/src/common/handler_factory.dart @@ -155,7 +155,7 @@ mixin CommandHandlerFactory { /// Deserializes the finder from JSON generated by [Command.serialize] or [CommandWithTarget.serialize]. Future handleCommand(Command command, WidgetController prober, CreateFinderFactory finderFactory) { - switch(command.kind) { + switch (command.kind) { case 'get_health': return _getHealth(command); case 'get_layer_tree': return _getLayerTree(command); case 'get_render_tree': return _getRenderTree(command); diff --git a/packages/flutter_driver/lib/src/driver/vmservice_driver.dart b/packages/flutter_driver/lib/src/driver/vmservice_driver.dart index 33c8140dc5..0b5506bffa 100644 --- a/packages/flutter_driver/lib/src/driver/vmservice_driver.dart +++ b/packages/flutter_driver/lib/src/driver/vmservice_driver.dart @@ -448,7 +448,7 @@ class VMServiceFlutterDriver extends FlutterDriver { Future _isPrecompiledMode() async { final List> flags = await getVmFlags(); - for(final Map flag in flags) { + for (final Map 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 f1b7311de3..5fd019873e 100644 --- a/packages/flutter_driver/lib/src/driver/web_driver.dart +++ b/packages/flutter_driver/lib/src/driver/web_driver.dart @@ -136,7 +136,7 @@ class WebFlutterDriver extends FlutterDriver { } _logCommunication('<<< $response'); - } on DriverError catch(_) { + } on DriverError catch (_) { rethrow; } catch (error, stackTrace) { throw DriverError( diff --git a/packages/flutter_goldens/lib/flutter_goldens.dart b/packages/flutter_goldens/lib/flutter_goldens.dart index b57f9a1a61..2e53f34233 100644 --- a/packages/flutter_goldens/lib/flutter_goldens.dart +++ b/packages/flutter_goldens/lib/flutter_goldens.dart @@ -477,7 +477,7 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC platform, ); - if(!baseDirectory.existsSync()) { + if (!baseDirectory.existsSync()) { baseDirectory.createSync(recursive: true); } diff --git a/packages/flutter_goldens_client/lib/skia_client.dart b/packages/flutter_goldens_client/lib/skia_client.dart index 06555747a4..e89a3068a9 100644 --- a/packages/flutter_goldens_client/lib/skia_client.dart +++ b/packages/flutter_goldens_client/lib/skia_client.dart @@ -221,7 +221,7 @@ class SkiaGoldClient { final File resultFile = workDirectory.childFile(fs.path.join( 'result-state.json', )); - if(await resultFile.exists()) { + if (await resultFile.exists()) { resultContents = await resultFile.readAsString(); } @@ -344,7 +344,7 @@ class SkiaGoldClient { final File resultFile = workDirectory.childFile(fs.path.join( 'result-state.json', )); - if(await resultFile.exists()) { + if (await resultFile.exists()) { resultContents = await resultFile.readAsString(); } final StringBuffer buf = StringBuffer() @@ -514,7 +514,7 @@ class SkiaGoldClient { 'auth_opt.json', ))/*!*/; - if(await authFile.exists()) { + if (await authFile.exists()) { final String contents = await authFile.readAsString(); final Map decoded = json.decode(contents) as Map; return !(decoded['GSUtil'] as bool/*!*/); diff --git a/packages/flutter_test/lib/src/controller.dart b/packages/flutter_test/lib/src/controller.dart index 8617e08a0c..1d33430062 100644 --- a/packages/flutter_test/lib/src/controller.dart +++ b/packages/flutter_test/lib/src/controller.dart @@ -1091,7 +1091,7 @@ abstract class WidgetController { ), ]), ...[ - for(int t = 0; t <= intervals; t += 1) + for (int t = 0; t <= intervals; t += 1) PointerEventRecord(timeStamps[t], [ PointerMoveEvent( timeStamp: timeStamps[t], diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index ff821aad56..4917d76d4f 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -2445,7 +2445,7 @@ class _MatchesSemanticsData extends Matcher { final bool actionExpected = actionEntry.value; final bool actionPresent = (action.index & data.actions) == action.index; if (actionPresent != actionExpected) { - if(actionExpected) { + if (actionExpected) { missingActions.add(action); } else { unexpectedActions.add(action); @@ -2490,7 +2490,7 @@ class _MatchesSemanticsData extends Matcher { final bool flagExpected = flagEntry.value; final bool flagPresent = flag.index & data.flags == flag.index; if (flagPresent != flagExpected) { - if(flagExpected) { + if (flagExpected) { missingFlags.add(flag); } else { unexpectedFlags.add(flag); diff --git a/packages/flutter_test/test/controller_test.dart b/packages/flutter_test/test/controller_test.dart index 9d060a23c5..0337264f36 100644 --- a/packages/flutter_test/test/controller_test.dart +++ b/packages/flutter_test/test/controller_test.dart @@ -285,7 +285,7 @@ void main() { await tester.tap(find.text('test'), buttons: kSecondaryMouseButton); const String b = '$kSecondaryMouseButton'; - for(int i = 0; i < logs.length; i++) { + for (int i = 0; i < logs.length; i++) { if (i == 0) { expect(logs[i], 'down $b'); } else if (i != logs.length - 1) { @@ -342,7 +342,7 @@ void main() { await tester.pumpAndSettle(); const String b = '$kSecondaryMouseButton'; - for(int i = 0; i < logs.length; i++) { + for (int i = 0; i < logs.length; i++) { if (i == 0) { expect(logs[i], 'down $b'); } else if (i != logs.length - 1) { @@ -374,7 +374,7 @@ void main() { await tester.drag(find.text('test'), const Offset(-150.0, 200.0), buttons: kSecondaryMouseButton); const String b = '$kSecondaryMouseButton'; - for(int i = 0; i < logs.length; i++) { + for (int i = 0; i < logs.length; i++) { if (i == 0) { expect(logs[i], 'down $b'); } else if (i != logs.length - 1) { @@ -408,7 +408,7 @@ void main() { await tester.drag(find.text('test'), const Offset(-150.0, 200.0), kind: PointerDeviceKind.trackpad); - for(int i = 0; i < logs.length; i++) { + for (int i = 0; i < logs.length; i++) { if (i == 0) { expect(logs[i], 'panZoomStart'); } else if (i != logs.length - 1) { @@ -441,7 +441,7 @@ void main() { await tester.pumpAndSettle(); const String b = '$kSecondaryMouseButton'; - for(int i = 0; i < logs.length; i++) { + for (int i = 0; i < logs.length; i++) { if (i == 0) { expect(logs[i], 'down $b'); } else if (i != logs.length - 1) { @@ -506,7 +506,7 @@ void main() { await tester.pumpAndSettle(); const String b = '$kSecondaryMouseButton'; - for(int i = 0; i < logs.length; i++) { + for (int i = 0; i < logs.length; i++) { if (i == 0) { expect(logs[i], 'down $b'); } else if (i != logs.length - 1) { diff --git a/packages/flutter_tools/lib/src/android/gradle_errors.dart b/packages/flutter_tools/lib/src/android/gradle_errors.dart index 4d48be20f3..e10e433727 100644 --- a/packages/flutter_tools/lib/src/android/gradle_errors.dart +++ b/packages/flutter_tools/lib/src/android/gradle_errors.dart @@ -159,7 +159,7 @@ final GradleHandledError multidexErrorHandler = GradleHandledError( prompt: 'Do you want to continue with adding multidex support for Android?', defaultChoiceIndex: 0, ); - } on StateError catch(e) { + } on StateError catch (e) { globals.printError( e.message, indent: 0, @@ -273,7 +273,7 @@ final GradleHandledError zipExceptionHandler = GradleHandledError( defaultChoiceIndex: 0, ); shouldDeleteUserGradle = selection == 'y'; - } on StateError catch(e) { + } on StateError catch (e) { globals.printError( e.message, indent: 0, diff --git a/packages/flutter_tools/lib/src/base/os.dart b/packages/flutter_tools/lib/src/base/os.dart index d5202b0071..1ce1951cef 100644 --- a/packages/flutter_tools/lib/src/base/os.dart +++ b/packages/flutter_tools/lib/src/base/os.dart @@ -340,7 +340,7 @@ class _LinuxUtils extends _PosixUtils { for (String entry in osReleaseSplit) { entry = entry.trim(); final List entryKeyValuePair = entry.split('='); - if(entryKeyValuePair[0] == key) { + if (entryKeyValuePair[0] == key) { final String value = entryKeyValuePair[1]; // Remove quotes from either end of the value if they exist final String quote = value[0]; diff --git a/packages/flutter_tools/lib/src/commands/assemble.dart b/packages/flutter_tools/lib/src/commands/assemble.dart index abf040f875..ba2b528dd7 100644 --- a/packages/flutter_tools/lib/src/commands/assemble.dart +++ b/packages/flutter_tools/lib/src/commands/assemble.dart @@ -260,7 +260,7 @@ class AssembleCommand extends FlutterCommand { final Map? defineConfigJsonMap = extractDartDefineConfigJsonMap(); final List dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap); - if(dartDefines.isNotEmpty){ + if (dartDefines.isNotEmpty){ results[kDartDefines] = dartDefines.join(','); } diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart index 022414ff73..3020561dc3 100644 --- a/packages/flutter_tools/lib/src/commands/drive.dart +++ b/packages/flutter_tools/lib/src/commands/drive.dart @@ -342,7 +342,7 @@ class DriveCommand extends RunCommandBase { if (testResult != 0) { throwToolExit(null); } - } on Exception catch(_) { + } on Exception catch (_) { // On exceptions, including ToolExit, take a screenshot on the device // unless a screenshot was already taken on test failure. if (!screenshotTaken && screenshot != null) { diff --git a/packages/flutter_tools/lib/src/commands/packages.dart b/packages/flutter_tools/lib/src/commands/packages.dart index 03ebd683f0..096bd72cd4 100644 --- a/packages/flutter_tools/lib/src/commands/packages.dart +++ b/packages/flutter_tools/lib/src/commands/packages.dart @@ -316,8 +316,8 @@ class PackagesGetCommand extends FlutterCommand { name, ...subArgs, // `dart pub get` and friends defaults to `--no-example`. - if(!exampleWasParsed && target != null) '--example', - if(directoryOption == null && relativeTarget != null) ...['--directory', relativeTarget], + if (!exampleWasParsed && target != null) '--example', + if (directoryOption == null && relativeTarget != null) ...['--directory', relativeTarget], ], project: rootProject, context: _context, diff --git a/packages/flutter_tools/lib/src/commands/symbolize.dart b/packages/flutter_tools/lib/src/commands/symbolize.dart index 061d375236..48091f73aa 100644 --- a/packages/flutter_tools/lib/src/commands/symbolize.dart +++ b/packages/flutter_tools/lib/src/commands/symbolize.dart @@ -200,7 +200,7 @@ class DwarfSymbolizationService { .listen((String line) { try { output.writeln(line); - } on Exception catch(e, s) { + } on Exception catch (e, s) { subscription?.cancel().whenComplete(() { if (!onDone.isCompleted) { onDone.completeError(e, s); diff --git a/packages/flutter_tools/lib/src/commands/validate_project.dart b/packages/flutter_tools/lib/src/commands/validate_project.dart index 75cfea48bf..faa3a28851 100644 --- a/packages/flutter_tools/lib/src/commands/validate_project.dart +++ b/packages/flutter_tools/lib/src/commands/validate_project.dart @@ -99,7 +99,7 @@ class ValidateProject { String getStringResult(ProjectValidatorResult result) { final String icon; - switch(result.status) { + switch (result.status) { case StatusProjectValidator.error: icon = '[✗]'; case StatusProjectValidator.info: diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index 311f87f59c..4136071ee2 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -348,7 +348,7 @@ class _DevFSHttpWriter implements DevFSWriter { DevFSContent content, { int retry = 0, }) async { - while(true) { + while (true) { try { final HttpClientRequest request = await _client.putUrl(httpAddress!); request.headers.removeAll(HttpHeaders.acceptEncodingHeader); diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart index 28c2c6ebbd..6f743e456a 100644 --- a/packages/flutter_tools/lib/src/flutter_manifest.dart +++ b/packages/flutter_tools/lib/src/flutter_manifest.dart @@ -682,7 +682,7 @@ void _validateFonts(YamlList fonts, List errors) { if (fontKey is! String) { errors.add('Expected "$fontKey" under "fonts" to be a string.'); } - switch(fontKey) { + switch (fontKey) { case 'asset': if (kvp.value is! String) { errors.add('Expected font asset ${kvp.value} ((${kvp.value.runtimeType})) to be a string.'); diff --git a/packages/flutter_tools/lib/src/flutter_plugins.dart b/packages/flutter_tools/lib/src/flutter_plugins.dart index dcb9a7694c..27fa5d611a 100644 --- a/packages/flutter_tools/lib/src/flutter_plugins.dart +++ b/packages/flutter_tools/lib/src/flutter_plugins.dart @@ -329,7 +329,7 @@ public final class GeneratedPluginRegistrant { {{#supportsEmbeddingV2}} try { flutterEngine.getPlugins().add(new {{package}}.{{class}}()); - } catch(Exception e) { + } catch (Exception e) { Log.e(TAG, "Error registering plugin {{name}}, {{package}}.{{class}}", e); } {{/supportsEmbeddingV2}} @@ -337,7 +337,7 @@ public final class GeneratedPluginRegistrant { {{#supportsEmbeddingV1}} try { {{package}}.{{class}}.registerWith(shimPluginRegistry.registrarFor("{{package}}.{{class}}")); - } catch(Exception e) { + } catch (Exception e) { Log.e(TAG, "Error registering plugin {{name}}, {{package}}.{{class}}", e); } {{/supportsEmbeddingV1}} diff --git a/packages/flutter_tools/lib/src/localizations/message_parser.dart b/packages/flutter_tools/lib/src/localizations/message_parser.dart index 4a99abbc1b..dc05744f16 100644 --- a/packages/flutter_tools/lib/src/localizations/message_parser.dart +++ b/packages/flutter_tools/lib/src/localizations/message_parser.dart @@ -131,7 +131,7 @@ $indent])'''; @override // ignore: avoid_equals_and_hash_code_on_mutable_classes, hash_and_equals bool operator==(covariant Node other) { - if(value != other.value + if (value != other.value || type != other.type || positionInMessage != other.positionInMessage || children.length != other.children.length @@ -305,7 +305,7 @@ class Parser { } else { // Handle keywords separately. Otherwise, lexer will assume parts of identifiers may be keywords. final String tokenStr = match.group(0)!; - switch(tokenStr) { + switch (tokenStr) { case 'plural': matchedType = ST.plural; case 'select': @@ -351,7 +351,7 @@ class Parser { final ST symbol = parsingStack.removeLast(); // Figure out which production rule to use. - switch(symbol) { + switch (symbol) { case ST.message: if (tokens.isEmpty) { parseAndConstructNode(ST.message, 4); @@ -530,7 +530,7 @@ class Parser { // plural parts and select parts. void checkExtraRules(Node syntaxTree) { final List children = syntaxTree.children; - switch(syntaxTree.type) { + switch (syntaxTree.type) { case ST.pluralParts: // Must have an "other" case. if (children.every((Node node) => node.children[0].type != ST.other)) { diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index 63f814b1ff..ac70d0f318 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart @@ -515,7 +515,7 @@ class AndroidProject extends FlutterProjectPlatform { } File get appManifestFile { - if(isUsingGradle) { + if (isUsingGradle) { return hostAppGradleRoot .childDirectory('app') .childDirectory('src') diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 40c6c24d84..2cbcfd8660 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -1450,7 +1450,7 @@ abstract class ResidentRunner extends ResidentHandlers { } try { await Future.wait(serveObservatoryRequests); - } on vm_service.RPCError catch(e) { + } on vm_service.RPCError catch (e) { globals.printWarning('Unable to enable Observatory: $e'); } } diff --git a/packages/flutter_tools/lib/src/web/compiler_config.dart b/packages/flutter_tools/lib/src/web/compiler_config.dart index 9c78caa8ee..286725b604 100644 --- a/packages/flutter_tools/lib/src/web/compiler_config.dart +++ b/packages/flutter_tools/lib/src/web/compiler_config.dart @@ -194,7 +194,7 @@ enum WasmOptLevel implements CliEnum { String get cliName => name; @override - String get helpText => switch(this) { + String get helpText => switch (this) { WasmOptLevel.none => 'wasm-opt is not run. Fastest build; bigger, slower output.', WasmOptLevel.debug => 'Similar to `${WasmOptLevel.full.name}`, but member names are preserved. Debugging is easier, but size is a bit bigger.', WasmOptLevel.full => 'wasm-opt is run. Build time is slower, but output is smaller and faster.', diff --git a/packages/flutter_tools/test/general.shard/base/file_system_test.dart b/packages/flutter_tools/test/general.shard/base/file_system_test.dart index e1bd3c3d73..a1b5472ef7 100644 --- a/packages/flutter_tools/test/general.shard/base/file_system_test.dart +++ b/packages/flutter_tools/test/general.shard/base/file_system_test.dart @@ -208,7 +208,7 @@ void main() { try { localFileSystem.systemTempDirectory; fail('expected tool exit'); - } on ToolExit catch(e) { + } on ToolExit catch (e) { expect(e.message, 'Your system temp directory (/does_not_exist) does not exist. ' 'Did you set an invalid override in your environment? ' 'See issue https://github.com/flutter/flutter/issues/74042 for more context.' diff --git a/packages/flutter_tools/test/general.shard/devfs_test.dart b/packages/flutter_tools/test/general.shard/devfs_test.dart index d0ab4e7fdd..bffa996c96 100644 --- a/packages/flutter_tools/test/general.shard/devfs_test.dart +++ b/packages/flutter_tools/test/general.shard/devfs_test.dart @@ -506,13 +506,13 @@ void main() { final MemoryIOSink frontendServerStdIn = MemoryIOSink(); Stream> frontendServerStdOut() async* { int processed = 0; - while(true) { - while(frontendServerStdIn.writes.length == processed) { + while (true) { + while (frontendServerStdIn.writes.length == processed) { await Future.delayed(const Duration(milliseconds: 5)); } String? boundaryKey; - while(processed < frontendServerStdIn.writes.length) { + while (processed < frontendServerStdIn.writes.length) { final List data = frontendServerStdIn.writes[processed]; final String stringData = utf8.decode(data); if (stringData.startsWith('compile ')) { diff --git a/packages/flutter_tools/test/general.shard/plugins_test.dart b/packages/flutter_tools/test/general.shard/plugins_test.dart index 8afbe91c13..811b3fd84f 100644 --- a/packages/flutter_tools/test/general.shard/plugins_test.dart +++ b/packages/flutter_tools/test/general.shard/plugins_test.dart @@ -1060,10 +1060,10 @@ dependencies: const String newPluginName = 'flutterEngine.getPlugins().add(new plugin1.UseNewEmbedding());'; const String oldPluginName = 'abcplugin1.UseOldEmbedding.registerWith(shimPluginRegistry.registrarFor("abcplugin1.UseOldEmbedding"));'; final String content = registrant.readAsStringSync(); - for(final String plugin in [newPluginName,oldPluginName]) { + for (final String plugin in [newPluginName,oldPluginName]) { expect(content, contains(plugin)); expect(content.split(plugin).first.trim().endsWith('try {'), isTrue); - expect(content.split(plugin).last.trim().startsWith('} catch(Exception e) {'), isTrue); + expect(content.split(plugin).last.trim().startsWith('} catch (Exception e) {'), isTrue); } }, overrides: { FileSystem: () => fs, diff --git a/packages/flutter_tools/test/integration.shard/observatory_port_test.dart b/packages/flutter_tools/test/integration.shard/observatory_port_test.dart index 453ce8ca77..94e5cf9f43 100644 --- a/packages/flutter_tools/test/integration.shard/observatory_port_test.dart +++ b/packages/flutter_tools/test/integration.shard/observatory_port_test.dart @@ -75,7 +75,7 @@ void main() { final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final int vmServicePort = await getFreePort(); int ddsPort = await getFreePort(); - while(ddsPort == vmServicePort) { + while (ddsPort == vmServicePort) { ddsPort = await getFreePort(); } // If both --dds-port and --vm-service-port are provided, --dds-port will be used by diff --git a/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart b/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart index 9477b7d8ac..47c07e70bd 100644 --- a/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart +++ b/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart @@ -357,11 +357,11 @@ PubspecEditor _setDartSDKVersionEditor(String version) { for (i++; i < lines.length; i++) { final String innerLine = lines[i]; final String sdkLine = " sdk: '$version'"; - if(innerLine.isNotEmpty && !innerLine.startsWith(' ')) { + if (innerLine.isNotEmpty && !innerLine.startsWith(' ')) { lines.insert(i, sdkLine); break; } - if(innerLine.startsWith(' sdk:')) { + if (innerLine.startsWith(' sdk:')) { lines[i] = sdkLine; break; } diff --git a/packages/flutter_tools/test/src/common.dart b/packages/flutter_tools/test/src/common.dart index 68f9ec1970..e97fb955e2 100644 --- a/packages/flutter_tools/test/src/common.dart +++ b/packages/flutter_tools/test/src/common.dart @@ -130,7 +130,7 @@ Future expectToolExitLater(Future future, Matcher messageMatcher) try { await future; fail('ToolExit expected, but nothing thrown'); - } on ToolExit catch(e) { + } on ToolExit catch (e) { expect(e.message, messageMatcher); // Catch all exceptions to give a better test failure message. } catch (e, trace) { // ignore: avoid_catches_without_on_clauses diff --git a/packages/flutter_tools/test/src/fake_devices.dart b/packages/flutter_tools/test/src/fake_devices.dart index 0b3529add5..33e6e1c3a0 100644 --- a/packages/flutter_tools/test/src/fake_devices.dart +++ b/packages/flutter_tools/test/src/fake_devices.dart @@ -230,7 +230,7 @@ class FakePollingDeviceDiscovery extends PollingDeviceDiscovery { } void setDevices(List devices) { - while(_devices.isNotEmpty) { + while (_devices.isNotEmpty) { _removeDevice(_devices.first); } devices.forEach(addDevice); diff --git a/packages/integration_test/lib/integration_test.dart b/packages/integration_test/lib/integration_test.dart index 75ee5b3aa4..d46276d1bd 100644 --- a/packages/integration_test/lib/integration_test.dart +++ b/packages/integration_test/lib/integration_test.dart @@ -263,7 +263,7 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab final String address = 'ws://localhost:${info.serverUri!.port}${info.serverUri!.path}ws'; try { _vmService = await _vmServiceConnectUri(address, httpClient: httpClient); - } on SocketException catch(e, s) { + } on SocketException catch (e, s) { throw StateError( 'Failed to connect to VM Service at $address.\n' 'This may happen if DDS is enabled. If this test was launched via '