diff --git a/analysis_options.yaml b/analysis_options.yaml index 4da1e9f1fb..6bf95b55f4 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -17,6 +17,7 @@ analyzer: language: strict-casts: true + strict-inference: true strict-raw-types: true errors: # allow self-reference to deprecated members (we do this because otherwise we have diff --git a/dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart b/dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart index 85c41d9deb..30458dd887 100644 --- a/dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart +++ b/dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart @@ -11,7 +11,7 @@ library dart.ui; /// /// ```dart /// class MyStringBuffer { -/// error; // error (missing_const_final_var_or_type, always_specify_types) +/// error; // error (prefer_typing_uninitialized_variables, inference_failure_on_uninitialized_variable, missing_const_final_var_or_type) /// /// StringBuffer _buffer = StringBuffer(); // error (prefer_final_fields, unused_field) /// } diff --git a/dev/bots/test/analyze-snippet-code-test-input/custom_imports_broken.dart b/dev/bots/test/analyze-snippet-code-test-input/custom_imports_broken.dart index cdf466efe2..46dc91139b 100644 --- a/dev/bots/test/analyze-snippet-code-test-input/custom_imports_broken.dart +++ b/dev/bots/test/analyze-snippet-code-test-input/custom_imports_broken.dart @@ -16,6 +16,6 @@ String? bar; /// error: widgets library was not imported (not even implicitly). /// ```dart -/// print(Widget); +/// print(Widget); // error (undefined_identifier) /// ``` String? foo; diff --git a/dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart b/dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart index a822e88ec0..2704029efc 100644 --- a/dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart +++ b/dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart @@ -131,7 +131,7 @@ /// Widget build(BuildContext context) { /// final String title; /// return Opacity( -/// key: globalKey, // error (undefined_identifier, argument_type_not_assignable) +/// key: globalKey, // error (undefined_identifier) /// opacity: _visible ? 1.0 : 0.0, /// child: Text(title), // error (read_potentially_unassigned_final) /// ); @@ -144,13 +144,14 @@ /// ``` /// /// ```dart -/// import 'dart:io'; // error (unused_import)/// final Widget p = Placeholder(); // error (undefined_class, undefined_function) +/// import 'dart:io'; // error (unused_import) +/// final Widget p = Placeholder(); // error (undefined_class, undefined_function) /// ``` /// /// ```dart /// // (e.g. in a stateful widget) /// void initState() { // error (must_call_super, annotate_overrides) -/// widget.toString(); // error (undefined_identifier, return_of_invalid_type) +/// widget.toString(); /// } /// ``` /// diff --git a/dev/bots/test/analyze_snippet_code_test.dart b/dev/bots/test/analyze_snippet_code_test.dart index 90b6366cb9..45ff34d405 100644 --- a/dev/bots/test/analyze_snippet_code_test.dart +++ b/dev/bots/test/analyze_snippet_code_test.dart @@ -21,16 +21,19 @@ const List expectedMainErrors = [ 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:134:14: (top-level declaration) (undefined_identifier)', 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:136:21: (top-level declaration) (read_potentially_unassigned_final)', 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:147:12: (self-contained program) (unused_import)', - 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:152:10: (stateful widget) (annotate_overrides)', - 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:152:10: (stateful widget) (must_call_super)', - 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:160:7: (top-level declaration) (undefined_identifier)', - 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:164: Found "```" in code but it did not match RegExp: pattern=^ */// *```dart\$ flags= so something is wrong. Line was: "/// ```"', + 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:148:11: (self-contained program) (undefined_class)', + 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:148:22: (self-contained program) (undefined_function)', + 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:153:10: (stateful widget) (annotate_overrides)', + 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:153:10: (stateful widget) (must_call_super)', + 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:161:7: (top-level declaration) (undefined_identifier)', + 'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:165: Found "```" in code but it did not match RegExp: pattern=^ */// *```dart\$ flags= so something is wrong. Line was: "/// ```"', 'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:9:12: (statement) (invalid_assignment)', 'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:18:4: Empty ```dart block in snippet code.', ]; const List expectedUiErrors = [ 'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (prefer_typing_uninitialized_variables)', + 'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (inference_failure_on_uninitialized_variable)', 'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (missing_const_final_var_or_type)', 'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (prefer_final_fields)', 'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (unused_field)', @@ -69,7 +72,7 @@ void main() { final List stderrNoDescriptions = stderrLines.map(removeLintDescriptions).toList(); expect(stderrNoDescriptions, [ ...expectedMainErrors, - 'Found 16 snippet code errors.', + 'Found 18 snippet code errors.', 'See the documentation at the top of dev/bots/analyze_snippet_code.dart for details.', '', // because we end with a newline, split gives us an extra blank line ]); @@ -93,7 +96,7 @@ void main() { expect(stderrNoDescriptions, [ ...expectedUiErrors, ...expectedMainErrors, - 'Found 20 snippet code errors.', + 'Found 23 snippet code errors.', 'See the documentation at the top of dev/bots/analyze_snippet_code.dart for details.', '', // because we end with a newline, split gives us an extra blank line ]); diff --git a/dev/conductor/core/test/packages_autoroller_test.dart b/dev/conductor/core/test/packages_autoroller_test.dart index 3861759b92..d320f731a4 100644 --- a/dev/conductor/core/test/packages_autoroller_test.dart +++ b/dev/conductor/core/test/packages_autoroller_test.dart @@ -170,7 +170,7 @@ void main() { await expectLater( () async { final Future rollFuture = autoroller.roll(); - await controller.stream.drain(); + await controller.stream.drain(); await rollFuture; }, throwsA(isA().having( @@ -214,7 +214,7 @@ void main() { ], stdout: '[{"number": 123}]'), ]); final Future rollFuture = autoroller.roll(); - await controller.stream.drain(); + await controller.stream.drain(); await rollFuture; expect(processManager, hasNoRemainingExpectations); expect(stdio.stdout, contains('flutter-pub-roller-bot already has open tool PRs')); @@ -312,7 +312,7 @@ void main() { ]), ]); final Future rollFuture = autoroller.roll(); - await controller.stream.drain(); + await controller.stream.drain(); await rollFuture; expect(processManager, hasNoRemainingExpectations); }); diff --git a/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart b/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart index 995b38918e..5ba8eb091b 100644 --- a/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart +++ b/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart @@ -16,7 +16,7 @@ const String _activityName = 'MainActivity'; const int _numberOfIterations = 10; Future _withApkInstall( - String apkPath, String bundleName, Function(AndroidDevice) body) async { + String apkPath, String bundleName, Future Function(AndroidDevice) body) async { final DeviceDiscovery devices = DeviceDiscovery(); final AndroidDevice device = await devices.workingDevice as AndroidDevice; await device.unlock(); diff --git a/dev/devicelab/lib/framework/runner.dart b/dev/devicelab/lib/framework/runner.dart index 39d0015db5..3696a9ce86 100644 --- a/dev/devicelab/lib/framework/runner.dart +++ b/dev/devicelab/lib/framework/runner.dart @@ -42,7 +42,7 @@ Future runTasks( List? taskArgs, bool useEmulator = false, @visibleForTesting Map? isolateParams, - @visibleForTesting Function(String) print = print, + @visibleForTesting void Function(String) print = print, @visibleForTesting List? logs, }) async { for (final String taskName in taskNames) { diff --git a/dev/integration_tests/ios_platform_view_tests/lib/main.dart b/dev/integration_tests/ios_platform_view_tests/lib/main.dart index 661e32d458..22025f261e 100644 --- a/dev/integration_tests/ios_platform_view_tests/lib/main.dart +++ b/dev/integration_tests/ios_platform_view_tests/lib/main.dart @@ -201,7 +201,7 @@ class _ZOrderTestPageState extends State { )), TextButton( onPressed: () { - showDialog( + showDialog( context: context, builder: (BuildContext context) { return const SizedBox( diff --git a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart index 560406e34c..49e42910fa 100644 --- a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart +++ b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart @@ -91,7 +91,7 @@ class _BottomNavigationBarExampleState extends State } void showModal(BuildContext context) { - showDialog( + showDialog( context: context, builder: (BuildContext context) => AlertDialog( content: const Text('Example Dialog'), diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart index 981eb5d812..b0056c37bc 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart @@ -174,7 +174,7 @@ class RootPage extends StatelessWidget { ElevatedButton( style: buttonStyle, onPressed: () { - showDialog( + showDialog( context: context, useRootNavigator: false, builder: _buildDialog, @@ -186,9 +186,9 @@ class RootPage extends StatelessWidget { ElevatedButton( style: buttonStyle, onPressed: () { - showDialog( + showDialog( context: context, - useRootNavigator: true, + useRootNavigator: true, // ignore: avoid_redundant_argument_values builder: _buildDialog, ); }, @@ -200,7 +200,7 @@ class RootPage extends StatelessWidget { return ElevatedButton( style: buttonStyle, onPressed: () { - showBottomSheet( + showBottomSheet( context: context, builder: (BuildContext context) { return Container( diff --git a/examples/api/lib/widgets/scroll_view/list_view.0.dart b/examples/api/lib/widgets/scroll_view/list_view.0.dart index 954995f4b9..870420fdfd 100644 --- a/examples/api/lib/widgets/scroll_view/list_view.0.dart +++ b/examples/api/lib/widgets/scroll_view/list_view.0.dart @@ -136,7 +136,7 @@ class GridBuilder extends StatefulWidget { }); final bool isSelectionMode; - final Function(bool)? onSelectionChange; + final ValueChanged? onSelectionChange; final List selectedList; @override @@ -189,7 +189,7 @@ class ListBuilder extends StatefulWidget { final bool isSelectionMode; final List selectedList; - final Function(bool)? onSelectionChange; + final ValueChanged? onSelectionChange; @override State createState() => _ListBuilderState(); diff --git a/packages/flutter/lib/src/cupertino/toggleable.dart b/packages/flutter/lib/src/cupertino/toggleable.dart index dacdab762b..a5fb38d9a6 100644 --- a/packages/flutter/lib/src/cupertino/toggleable.dart +++ b/packages/flutter/lib/src/cupertino/toggleable.dart @@ -111,7 +111,7 @@ mixin ToggleableStateMixin on TickerProviderStateMixin /// build method - potentially after wrapping it in other widgets. Widget buildToggleable({ FocusNode? focusNode, - Function(bool)? onFocusChange, + ValueChanged? onFocusChange, bool autofocus = false, required Size size, required CustomPainter painter, diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index aea0f76e09..75f8b3e779 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -440,7 +440,7 @@ class _DragHandle extends StatelessWidget { }); final VoidCallback? onSemanticsTap; - final Function(bool) handleHover; + final ValueChanged handleHover; final Set materialState; final Color? dragHandleColor; final Size? dragHandleSize; diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart index aca371a684..975bbb54c8 100644 --- a/packages/flutter/lib/src/material/switch.dart +++ b/packages/flutter/lib/src/material/switch.dart @@ -710,7 +710,7 @@ class _MaterialSwitch extends StatefulWidget { final MaterialStateProperty? overlayColor; final double? splashRadius; final FocusNode? focusNode; - final Function(bool)? onFocusChange; + final ValueChanged? onFocusChange; final bool autofocus; final Size size; diff --git a/packages/flutter/lib/src/material/toggleable.dart b/packages/flutter/lib/src/material/toggleable.dart index daa9bdb7f3..ecf19d37e4 100644 --- a/packages/flutter/lib/src/material/toggleable.dart +++ b/packages/flutter/lib/src/material/toggleable.dart @@ -302,7 +302,7 @@ mixin ToggleableStateMixin on TickerProviderStateMixin /// build method - potentially after wrapping it in other widgets. Widget buildToggleable({ FocusNode? focusNode, - Function(bool)? onFocusChange, + ValueChanged? onFocusChange, bool autofocus = false, required MaterialStateProperty mouseCursor, required Size size, diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index efb0fcf2e1..3b78bd7387 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -5470,7 +5470,7 @@ class NavigatorState extends State with TickerProviderStateMixin, Res } /// Gets first route entry satisfying the predicate, or null if not found. - _RouteEntry? _firstRouteEntryWhereOrNull(_RouteEntryPredicate test) { + _RouteEntry? _firstRouteEntryWhereOrNull(_RouteEntryPredicate test) { for (final _RouteEntry element in _history) { if (test(element)) { return element; @@ -5480,7 +5480,7 @@ class NavigatorState extends State with TickerProviderStateMixin, Res } /// Gets last route entry satisfying the predicate, or null if not found. - _RouteEntry? _lastRouteEntryWhereOrNull(_RouteEntryPredicate test) { + _RouteEntry? _lastRouteEntryWhereOrNull(_RouteEntryPredicate test) { _RouteEntry? result; for (final _RouteEntry element in _history) { if (test(element)) { diff --git a/packages/flutter/test/material/popup_menu_test.dart b/packages/flutter/test/material/popup_menu_test.dart index e2fa281b63..5dec66dd1d 100644 --- a/packages/flutter/test/material/popup_menu_test.dart +++ b/packages/flutter/test/material/popup_menu_test.dart @@ -3352,7 +3352,7 @@ void main() { itemBuilder: (BuildContext context) => >[ PopupMenuItem( onTap: () { - showModalBottomSheet( + showModalBottomSheet( context: context, builder: (BuildContext context) { return const SizedBox( diff --git a/packages/flutter/test/painting/colors_test.dart b/packages/flutter/test/painting/colors_test.dart index cee4ffaa30..4671d29db9 100644 --- a/packages/flutter/test/painting/colors_test.dart +++ b/packages/flutter/test/painting/colors_test.dart @@ -464,7 +464,7 @@ void main() { }); test('ColorSwatch.lerp identical a,b', () { - expect(ColorSwatch.lerp(null, null, 0), null); + expect(ColorSwatch.lerp(null, null, 0), null); const ColorSwatch color = ColorSwatch(0x00000000, {1: Color(0x00000000)}); expect(identical(ColorSwatch.lerp(color, color, 0.5), color), true); }); diff --git a/packages/flutter/test/rendering/proxy_box_test.dart b/packages/flutter/test/rendering/proxy_box_test.dart index 45b34a1235..4dfa6c2b9b 100644 --- a/packages/flutter/test/rendering/proxy_box_test.dart +++ b/packages/flutter/test/rendering/proxy_box_test.dart @@ -881,7 +881,7 @@ void main() { }); // Simulate painting a RenderBox as if 'debugPaintSizeEnabled == true' - Function(PaintingContext, Offset) debugPaint(RenderBox renderBox) { + DebugPaintCallback debugPaint(RenderBox renderBox) { layout(renderBox); pumpFrame(phase: EnginePhase.compositingBits); return (PaintingContext context, Offset offset) { @@ -891,7 +891,7 @@ void main() { } test('RenderClipPath.debugPaintSize draws a path and a debug text when clipBehavior is not Clip.none', () { - Function(PaintingContext, Offset) debugPaintClipRect(Clip clip) { + DebugPaintCallback debugPaintClipRect(Clip clip) { final RenderBox child = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200, height: 200)); final RenderClipPath renderClipPath = RenderClipPath(clipBehavior: clip, child: child); return debugPaint(renderClipPath); @@ -908,7 +908,7 @@ void main() { }); test('RenderClipRect.debugPaintSize draws a rect and a debug text when clipBehavior is not Clip.none', () { - Function(PaintingContext, Offset) debugPaintClipRect(Clip clip) { + DebugPaintCallback debugPaintClipRect(Clip clip) { final RenderBox child = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200, height: 200)); final RenderClipRect renderClipRect = RenderClipRect(clipBehavior: clip, child: child); return debugPaint(renderClipRect); @@ -924,7 +924,7 @@ void main() { }); test('RenderClipRRect.debugPaintSize draws a rounded rect and a debug text when clipBehavior is not Clip.none', () { - Function(PaintingContext, Offset) debugPaintClipRRect(Clip clip) { + DebugPaintCallback debugPaintClipRRect(Clip clip) { final RenderBox child = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200, height: 200)); final RenderClipRRect renderClipRRect = RenderClipRRect(clipBehavior: clip, child: child); return debugPaint(renderClipRRect); @@ -940,7 +940,7 @@ void main() { }); test('RenderClipOval.debugPaintSize draws a path and a debug text when clipBehavior is not Clip.none', () { - Function(PaintingContext, Offset) debugPaintClipOval(Clip clip) { + DebugPaintCallback debugPaintClipOval(Clip clip) { final RenderBox child = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200, height: 200)); final RenderClipOval renderClipOval = RenderClipOval(clipBehavior: clip, child: child); return debugPaint(renderClipOval); @@ -1085,3 +1085,5 @@ void expectAssertionError() { FlutterError.reportError(errorDetails); } } + +typedef DebugPaintCallback = void Function(PaintingContext context, Offset offset); diff --git a/packages/flutter/test/widgets/media_query_test.dart b/packages/flutter/test/widgets/media_query_test.dart index 35b0ba95e0..f2608a2140 100644 --- a/packages/flutter/test/widgets/media_query_test.dart +++ b/packages/flutter/test/widgets/media_query_test.dart @@ -11,7 +11,7 @@ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class _MediaQueryAspectCase { const _MediaQueryAspectCase(this.method, this.data); - final Function(BuildContext) method; + final void Function(BuildContext) method; final MediaQueryData data; } diff --git a/packages/flutter/test/widgets/sliver_cross_axis_group_test.dart b/packages/flutter/test/widgets/sliver_cross_axis_group_test.dart index 8755d358e8..139077213f 100644 --- a/packages/flutter/test/widgets/sliver_cross_axis_group_test.dart +++ b/packages/flutter/test/widgets/sliver_cross_axis_group_test.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -327,7 +328,7 @@ void main() { testWidgets('Assertion error when SliverExpanded is used outside of SliverCrossAxisGroup', (WidgetTester tester) async { final List errors = []; - final Function(FlutterErrorDetails)? oldHandler = FlutterError.onError; + final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails error) => errors.add(error); await tester.pumpWidget( @@ -459,7 +460,7 @@ void main() { testWidgetsWithLeakTracking('Assertion error when constrained widget runs out of cross axis extent', (WidgetTester tester) async { final List errors = []; - final Function(FlutterErrorDetails)? oldHandler = FlutterError.onError; + final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails error) => errors.add(error); final List items = List.generate(20, (int i) => i); @@ -481,7 +482,7 @@ void main() { testWidgetsWithLeakTracking('Assertion error when expanded widget runs out of cross axis extent', (WidgetTester tester) async { final List errors = []; - final Function(FlutterErrorDetails)? oldHandler = FlutterError.onError; + final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails error) => errors.add(error); final List items = List.generate(20, (int i) => i); diff --git a/packages/flutter_test/lib/src/_binding_io.dart b/packages/flutter_test/lib/src/_binding_io.dart index 2123956cef..a789b9aabe 100644 --- a/packages/flutter_test/lib/src/_binding_io.dart +++ b/packages/flutter_test/lib/src/_binding_io.dart @@ -128,7 +128,7 @@ class _MockHttpClient implements HttpClient { bool Function(X509Certificate cert, String host, int port)? badCertificateCallback; @override - Function(String line)? keyLog; + void Function(String line)? keyLog; @override void close({ bool force = false }) { } diff --git a/packages/flutter_test/test/utils/fake_and_mock_utils.dart b/packages/flutter_test/test/utils/fake_and_mock_utils.dart index db2b7ba438..8f5fcf1720 100644 --- a/packages/flutter_test/test/utils/fake_and_mock_utils.dart +++ b/packages/flutter_test/test/utils/fake_and_mock_utils.dart @@ -19,7 +19,7 @@ void verifyPropertyFaked({ required TProperty realValue, required TProperty fakeValue, required TProperty Function() propertyRetriever, - required Function(TestWidgetsFlutterBinding, TProperty fakeValue) propertyFaker, + required void Function(TestWidgetsFlutterBinding, TProperty fakeValue) propertyFaker, Matcher Function(TProperty) matcher = equals, }) { TProperty propertyBeforeFaking; @@ -45,8 +45,8 @@ void verifyPropertyReset({ required WidgetTester tester, required TProperty fakeValue, required TProperty Function() propertyRetriever, - required Function() propertyResetter, - required Function(TProperty fakeValue) propertyFaker, + required VoidCallback propertyResetter, + required ValueSetter propertyFaker, Matcher Function(TProperty) matcher = equals, }) { TProperty propertyBeforeFaking; diff --git a/packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart index e5bce99b63..7862b4d919 100644 --- a/packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart @@ -80,7 +80,7 @@ void main () { expect(iosDeployDebugger.logLines, emits('Did finish launching.')); expect(await iosDeployDebugger.launchAndAttach(), isTrue); - await iosDeployDebugger.logLines.drain(); + await iosDeployDebugger.logLines.drain(); expect(processManager, hasNoRemainingExpectations); expect(appDeltaDirectory, exists); }); @@ -141,7 +141,7 @@ void main () { 'process detach', ])); expect(await iosDeployDebugger.launchAndAttach(), isTrue); - await logLines.drain(); + await logLines.drain(); expect(logger.traceText, contains('PROCESS_STOPPED')); expect(logger.traceText, contains('thread backtrace all')); @@ -189,7 +189,7 @@ void main () { expect(iosDeployDebugger.logLines, emitsDone); expect(await iosDeployDebugger.launchAndAttach(), isFalse); - await iosDeployDebugger.logLines.drain(); + await iosDeployDebugger.logLines.drain(); }); testWithoutContext('app exit', () async { @@ -209,7 +209,7 @@ void main () { ])); expect(await iosDeployDebugger.launchAndAttach(), isTrue); - await iosDeployDebugger.logLines.drain(); + await iosDeployDebugger.logLines.drain(); }); testWithoutContext('app crash', () async { @@ -239,7 +239,7 @@ void main () { ])); expect(await iosDeployDebugger.launchAndAttach(), isTrue); - await iosDeployDebugger.logLines.drain(); + await iosDeployDebugger.logLines.drain(); expect(logger.traceText, contains('Process 6156 stopped')); expect(logger.traceText, contains('thread backtrace all')); @@ -263,7 +263,7 @@ void main () { expect(iosDeployDebugger.logLines, emitsDone); expect(await iosDeployDebugger.launchAndAttach(), isFalse); - await iosDeployDebugger.logLines.drain(); + await iosDeployDebugger.logLines.drain(); }); testWithoutContext('no provisioning profile 1, stdout', () async { @@ -364,7 +364,7 @@ void main () { 'Log on attach2', ])); expect(await iosDeployDebugger.launchAndAttach(), isTrue); - await logLines.drain(); + await logLines.drain(); expect(LineSplitter.split(logger.traceText), containsOnce('Received logs from ios-deploy.')); }); diff --git a/packages/flutter_tools/test/integration.shard/debug_adapter/test_server.dart b/packages/flutter_tools/test/integration.shard/debug_adapter/test_server.dart index f92da208d4..49ca2cebf3 100644 --- a/packages/flutter_tools/test/integration.shard/debug_adapter/test_server.dart +++ b/packages/flutter_tools/test/integration.shard/debug_adapter/test_server.dart @@ -19,7 +19,7 @@ abstract class DapTestServer { Future stop(); StreamSink> get sink; Stream> get stream; - Function(String message)? onStderrOutput; + void Function(String message)? onStderrOutput; } /// An instance of a DAP server running in-process (to aid debugging). @@ -83,7 +83,7 @@ class OutOfProcessDapTestServer extends DapTestServer { .listen((String error) { logger?.call(error); if (!_isShuttingDown) { - final Function(String message)? stderrHandler = onStderrOutput; + final void Function(String message)? stderrHandler = onStderrOutput; if (stderrHandler != null) { stderrHandler(error); } else { diff --git a/packages/flutter_tools/test/src/fake_http_client.dart b/packages/flutter_tools/test/src/fake_http_client.dart index b30074274b..e21db1cd39 100644 --- a/packages/flutter_tools/test/src/fake_http_client.dart +++ b/packages/flutter_tools/test/src/fake_http_client.dart @@ -147,7 +147,7 @@ class FakeHttpClient implements HttpClient { bool Function(X509Certificate cert, String host, int port)? badCertificateCallback; @override - Function(String line)? keyLog; + void Function(String line)? keyLog; @override void close({bool force = false}) { }