diff --git a/analysis_options.yaml b/analysis_options.yaml index c33c15e544991..f4e9378bdf958 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,6 +7,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/ci/bin/format.dart b/ci/bin/format.dart index 1e4de1455edfd..8e1c1b1d6b3c6 100644 --- a/ci/bin/format.dart +++ b/ci/bin/format.dart @@ -99,7 +99,7 @@ Future _runGit( return result.stdout; } -typedef MessageCallback = Function(String? message, {MessageType type}); +typedef MessageCallback = void Function(String? message, {MessageType type}); /// Base class for format checkers. /// diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 5c2244d43a9ad..2d228e1bf66ba 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -288,8 +288,7 @@ bool _onError(Object error, StackTrace? stackTrace) { return PlatformDispatcher.instance._dispatchError(error, stackTrace ?? StackTrace.empty); } -// ignore: always_declare_return_types, prefer_generic_function_type_aliases -typedef _ListStringArgFunction(List args); +typedef _ListStringArgFunction = Object? Function(List args); @pragma('vm:entry-point') void _runMain(Function startMainIsolateFunction, diff --git a/lib/web_ui/test/canvaskit/surface_test.dart b/lib/web_ui/test/canvaskit/surface_test.dart index e31ca43bf8079..b4f55330f9ea5 100644 --- a/lib/web_ui/test/canvaskit/surface_test.dart +++ b/lib/web_ui/test/canvaskit/surface_test.dart @@ -150,7 +150,7 @@ void testMain() { 'getExtension', ['WEBGL_lose_context'], ); - js_util.callMethod(loseContextExtension, 'loseContext', const []); + js_util.callMethod(loseContextExtension, 'loseContext', const []); // Pump a timer to allow the "lose context" event to propagate. await Future.delayed(Duration.zero); @@ -160,7 +160,7 @@ void testMain() { expect(isContextLost, isTrue); // Emulate WebGL context restoration. - js_util.callMethod(loseContextExtension, 'restoreContext', const []); + js_util.callMethod(loseContextExtension, 'restoreContext', const []); // Pump a timer to allow the "restore context" event to propagate. await Future.delayed(Duration.zero); diff --git a/lib/web_ui/test/engine/pointer_binding_test.dart b/lib/web_ui/test/engine/pointer_binding_test.dart index 2f7af70ddd51a..613b247ee1391 100644 --- a/lib/web_ui/test/engine/pointer_binding_test.dart +++ b/lib/web_ui/test/engine/pointer_binding_test.dart @@ -3606,7 +3606,7 @@ mixin _ButtonedEventMixin on _BasicEventContext { }); // timeStamp can't be set in the constructor, need to override the getter. if (timeStamp != null) { - js_util.callMethod( + js_util.callMethod( objectConstructor, 'defineProperty', [ diff --git a/testing/scenario_app/bin/utils/logs.dart b/testing/scenario_app/bin/utils/logs.dart index 41800342d193f..0c7c8a6873bf3 100644 --- a/testing/scenario_app/bin/utils/logs.dart +++ b/testing/scenario_app/bin/utils/logs.dart @@ -10,7 +10,7 @@ String _red = _supportsAnsi ? '\u001b[31m' : ''; String _gray = _supportsAnsi ? '\u001b[90m' : ''; String _reset = _supportsAnsi? '\u001B[0m' : ''; -Future step(String msg, Function() fn) async { +Future step(String msg, Future Function() fn) async { stdout.writeln('-> $_green$msg$_reset'); try { await fn();