Prepare for the latest dart_flutter_team_lints (#2127)

Eagerly apply autofixes and manual fixes in the code before landing
dependabot PRs #2124 and #2125

Ignore the `comment_references` lint since there are false positives
(likely amongst true positives) in these packages.
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 9913045..f6b2dc1 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -11,6 +11,7 @@
     # Ignoring a number of lints from dart_flutter_team_lints – for now
     avoid_catching_errors: ignore
     avoid_dynamic_calls: ignore
+    comment_references: ignore
     lines_longer_than_80_chars: ignore
     only_throw_errors: ignore
     unawaited_futures: ignore
diff --git a/pkgs/test/lib/src/runner/browser/browser.dart b/pkgs/test/lib/src/runner/browser/browser.dart
index be6d747..b025ea2 100644
--- a/pkgs/test/lib/src/runner/browser/browser.dart
+++ b/pkgs/test/lib/src/runner/browser/browser.dart
@@ -87,7 +87,7 @@
       // resolve the ambiguity is to wait a brief amount of time and see if this
       // browser is actually closed.
       if (!_closed && exitCode < 0) {
-        await Future.delayed(Duration(milliseconds: 200));
+        await Future<void>.delayed(const Duration(milliseconds: 200));
       }
 
       if (!_closed && exitCode != 0) {
diff --git a/pkgs/test/lib/src/runner/browser/browser_manager.dart b/pkgs/test/lib/src/runner/browser/browser_manager.dart
index c38e103..49eb6fa 100644
--- a/pkgs/test/lib/src/runner/browser/browser_manager.dart
+++ b/pkgs/test/lib/src/runner/browser/browser_manager.dart
@@ -138,7 +138,7 @@
       completer.completeError(error, stackTrace);
     });
 
-    return completer.future.timeout(Duration(seconds: 30), onTimeout: () {
+    return completer.future.timeout(const Duration(seconds: 30), onTimeout: () {
       browser.close();
       if (attempt >= _maxRetries) {
         throw ApplicationException(
@@ -174,7 +174,7 @@
     //
     // Start this canceled because we don't want it to start ticking until we
     // get some response from the iframe.
-    _timer = RestartableTimer(Duration(seconds: 3), () {
+    _timer = RestartableTimer(const Duration(seconds: 3), () {
       for (var controller in _controllers) {
         controller.setDebugging(true);
       }
@@ -335,7 +335,7 @@
         _controllers.clear();
         return _browser.close();
       });
-  final _closeMemoizer = AsyncMemoizer();
+  final _closeMemoizer = AsyncMemoizer<void>();
 }
 
 /// An implementation of [Environment] for the browser.
diff --git a/pkgs/test/lib/src/runner/browser/chrome.dart b/pkgs/test/lib/src/runner/browser/chrome.dart
index a67b8ee..e7dff75 100644
--- a/pkgs/test/lib/src/runner/browser/chrome.dart
+++ b/pkgs/test/lib/src/runner/browser/chrome.dart
@@ -97,9 +97,8 @@
     return coverage;
   }
 
-  Chrome._(Future<Process> Function() startBrowser, this.remoteDebuggerUrl,
-      this._tabConnection, this._idToUrl)
-      : super(startBrowser);
+  Chrome._(super.startBrowser, this.remoteDebuggerUrl, this._tabConnection,
+      this._idToUrl);
 
   Future<Uri?> _sourceUriProvider(String sourceUrl, String scriptId) async {
     var script = _idToUrl[scriptId];
@@ -136,7 +135,7 @@
   // Wait for Chrome to be in a ready state.
   await process.stderr
       .transform(utf8.decoder)
-      .transform(LineSplitter())
+      .transform(const LineSplitter())
       .firstWhere((line) => line.startsWith('DevTools listening'));
 
   var chromeConnection = ChromeConnection('localhost', port);
@@ -147,7 +146,7 @@
     var tabs = await chromeConnection.getTabs();
     tab = tabs.firstWhereOrNull((tab) => tab.url == url.toString());
     if (tab == null) {
-      await Future.delayed(Duration(milliseconds: 100));
+      await Future<void>.delayed(const Duration(milliseconds: 100));
       if (attempt > 5) {
         throw StateError('Could not connect to test tab with url: $url');
       }
diff --git a/pkgs/test/lib/src/runner/browser/chromium.dart b/pkgs/test/lib/src/runner/browser/chromium.dart
index e2a456f..b0243ba 100644
--- a/pkgs/test/lib/src/runner/browser/chromium.dart
+++ b/pkgs/test/lib/src/runner/browser/chromium.dart
@@ -5,12 +5,12 @@
 import 'dart:async';
 import 'dart:io';
 
-import 'package:test/src/runner/browser/default_settings.dart';
 import 'package:test_api/src/backend/runtime.dart'; // ignore: implementation_imports
 import 'package:test_core/src/runner/configuration.dart'; // ignore: implementation_imports
 import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports
 
 import '../executable_settings.dart';
+import 'default_settings.dart';
 
 enum ChromiumBasedBrowser {
   chrome(Runtime.chrome),
diff --git a/pkgs/test/lib/src/runner/browser/dom.dart b/pkgs/test/lib/src/runner/browser/dom.dart
index 21b41fe..d0fba48 100644
--- a/pkgs/test/lib/src/runner/browser/dom.dart
+++ b/pkgs/test/lib/src/runner/browser/dom.dart
@@ -114,7 +114,7 @@
   void addEventListener(String type, EventListener? listener,
       [bool? useCapture]) {
     if (listener != null) {
-      js_util.callMethod(this, 'addEventListener',
+      js_util.callMethod<void>(this, 'addEventListener',
           <Object>[type, listener, if (useCapture != null) useCapture]);
     }
   }
@@ -122,7 +122,7 @@
   void removeEventListener(String type, EventListener? listener,
       [bool? useCapture]) {
     if (listener != null) {
-      js_util.callMethod(this, 'removeEventListener',
+      js_util.callMethod<void>(this, 'removeEventListener',
           <Object>[type, listener, if (useCapture != null) useCapture]);
     }
   }
diff --git a/pkgs/test/lib/src/runner/browser/platform.dart b/pkgs/test/lib/src/runner/browser/platform.dart
index 9a742a2..dc28f65 100644
--- a/pkgs/test/lib/src/runner/browser/platform.dart
+++ b/pkgs/test/lib/src/runner/browser/platform.dart
@@ -151,7 +151,7 @@
           .add(_wrapperHandler);
     }
 
-    var pipeline = shelf.Pipeline()
+    var pipeline = const shelf.Pipeline()
         .addMiddleware(PathHandler.nestedIn(_secret))
         .addHandler(cascade.handler);
 
@@ -305,7 +305,7 @@
   Future<void> _pubServeSuite(String path, Uri dartUrl, Runtime browser,
       SuiteConfiguration suiteConfig) {
     return _pubServePool.withResource(() async {
-      var timer = Timer(Duration(seconds: 1), () {
+      var timer = Timer(const Duration(seconds: 1), () {
         print('"pub serve" is compiling $path...');
       });
 
@@ -317,7 +317,7 @@
 
         if (response.statusCode != 200) {
           // Drain response to avoid VM hang.
-          response.drain();
+          response.drain<void>();
 
           throw LoadException(
               path,
@@ -328,7 +328,7 @@
 
         if (suiteConfig.jsTrace) {
           // Drain response to avoid VM hang.
-          response.drain();
+          response.drain<void>();
           return;
         }
         _mappers[path] = JSStackTraceMapper(await utf8.decodeStream(response),
diff --git a/pkgs/test/lib/src/runner/node/platform.dart b/pkgs/test/lib/src/runner/node/platform.dart
index 9e42fa8..5910fd0 100644
--- a/pkgs/test/lib/src/runner/node/platform.dart
+++ b/pkgs/test/lib/src/runner/node/platform.dart
@@ -86,8 +86,8 @@
           'Unsupported compiler for the Node platform ${platform.compiler}.');
     }
     var pair = await _loadChannel(path, platform, suiteConfig);
-    var controller = deserializeSuite(
-        path, platform, suiteConfig, PluginEnvironment(), pair.first, message);
+    var controller = deserializeSuite(path, platform, suiteConfig,
+        const PluginEnvironment(), pair.first, message);
 
     controller.channel('test.node.mapper').sink.add(pair.last?.serialize());
 
diff --git a/pkgs/test/lib/src/runner/wasm/platform.dart b/pkgs/test/lib/src/runner/wasm/platform.dart
index 803927c..e14e0c7 100644
--- a/pkgs/test/lib/src/runner/wasm/platform.dart
+++ b/pkgs/test/lib/src/runner/wasm/platform.dart
@@ -140,7 +140,7 @@
         .add(createStaticHandler(_root))
         .add(_wrapperHandler);
 
-    var pipeline = shelf.Pipeline()
+    var pipeline = const shelf.Pipeline()
         .addMiddleware(PathHandler.nestedIn(_secret))
         .addHandler(cascade.handler);
 
diff --git a/pkgs/test/test/common.dart b/pkgs/test/test/common.dart
index abdb5e5..1cad23f 100644
--- a/pkgs/test/test/common.dart
+++ b/pkgs/test/test/common.dart
@@ -3,4 +3,4 @@
 // BSD-style license that can be found in the LICENSE file.
 import 'package:test/test.dart';
 
-void myTest(String name, Function() testFn) => test(name, testFn);
+void myTest(String name, void Function() testFn) => test(name, testFn);
diff --git a/pkgs/test/test/runner/browser/chrome_test.dart b/pkgs/test/test/runner/browser/chrome_test.dart
index 80a0683..ffec227 100644
--- a/pkgs/test/test/runner/browser/chrome_test.dart
+++ b/pkgs/test/test/runner/browser/chrome_test.dart
@@ -36,7 +36,7 @@
   },
       // It's not clear why, but this test in particular seems to time out
       // when run in parallel with many other tests.
-      timeout: Timeout.factor(2));
+      timeout: const Timeout.factor(2));
 
   test("a process can be killed synchronously after it's started", () async {
     var server = await CodeServer.start();
diff --git a/pkgs/test/test/runner/browser/microsoft_edge_test.dart b/pkgs/test/test/runner/browser/microsoft_edge_test.dart
index 2d3e4cf..a48bfd2 100644
--- a/pkgs/test/test/runner/browser/microsoft_edge_test.dart
+++ b/pkgs/test/test/runner/browser/microsoft_edge_test.dart
@@ -33,7 +33,7 @@
     addTearDown(() => edge.close());
 
     expect(await (await webSocket).stream.first, equals('loaded!'));
-  }, timeout: Timeout.factor(2));
+  }, timeout: const Timeout.factor(2));
 
   test('reports an error in onExit', () {
     var edge = MicrosoftEdge(Uri.parse('https://dart.dev'), configuration(),
diff --git a/pkgs/test/test/runner/configuration/top_level_test.dart b/pkgs/test/test/runner/configuration/top_level_test.dart
index 8158cc5..97ce5cc 100644
--- a/pkgs/test/test/runner/configuration/top_level_test.dart
+++ b/pkgs/test/test/runner/configuration/top_level_test.dart
@@ -92,7 +92,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
diff --git a/pkgs/test/test/runner/engine_test.dart b/pkgs/test/test/runner/engine_test.dart
index 428ca0f..6cc1cda 100644
--- a/pkgs/test/test/runner/engine_test.dart
+++ b/pkgs/test/test/runner/engine_test.dart
@@ -60,7 +60,7 @@
   });
 
   test('returns fail if any test does not complete', () async {
-    var completer = Completer();
+    var completer = Completer<void>();
     var engine = declareEngine(() {
       test('completes', () {});
       test('does not complete', () async {
@@ -161,7 +161,7 @@
     var engine = declareEngine(() {
       // This ensures that the first test doesn't actually finish until the
       // second test runs.
-      var firstTestCompleter = Completer();
+      var firstTestCompleter = Completer<void>();
 
       group('group', () {
         tearDown(tearDownBody);
@@ -169,7 +169,7 @@
         test('first test', () async {
           await firstTestCompleter.future;
           firstTestFinished = true;
-        }, timeout: Timeout(Duration.zero));
+        }, timeout: const Timeout(Duration.zero));
       });
 
       test('second test', () {
@@ -311,7 +311,7 @@
           }
           // Simulate the test/loading taking some amount of time so that
           // we actually reach max concurrency.
-          await Future.delayed(Duration(milliseconds: 100));
+          await Future<void>.delayed(const Duration(milliseconds: 100));
           if (!isLoadSuite) {
             testsRunning--;
             testsLoaded--;
diff --git a/pkgs/test/test/runner/load_suite_test.dart b/pkgs/test/test/runner/load_suite_test.dart
index aa35d38..ab5fc79 100644
--- a/pkgs/test/test/runner/load_suite_test.dart
+++ b/pkgs/test/test/runner/load_suite_test.dart
@@ -55,11 +55,11 @@
 
     var liveTest = (suite.group.entries.single as Test).load(suite);
     expect(liveTest.run(), completes);
-    await Future.delayed(Duration.zero);
+    await Future<void>.delayed(Duration.zero);
     expect(liveTest.state.status, equals(Status.running));
 
     completer.complete(innerSuite);
-    await Future.delayed(Duration.zero);
+    await Future<void>.delayed(Duration.zero);
     expectTestPassed(liveTest);
   });
 
@@ -84,7 +84,7 @@
 
     var liveTest = (suite.group.entries.single as Test).load(suite);
     expect(liveTest.run(), completes);
-    await Future.delayed(Duration.zero);
+    await Future<void>.delayed(Duration.zero);
     expect(liveTest.state.status, equals(Status.running));
 
     expect(liveTest.close(), completes);
diff --git a/pkgs/test/test/runner/parse_metadata_test.dart b/pkgs/test/test/runner/parse_metadata_test.dart
index 5fb7434..a8ffa9c 100644
--- a/pkgs/test/test/runner/parse_metadata_test.dart
+++ b/pkgs/test/test/runner/parse_metadata_test.dart
@@ -81,7 +81,7 @@
 ''', {});
       expect(
           metadata.timeout.duration,
-          equals(Duration(
+          equals(const Duration(
               hours: 1,
               minutes: 2,
               seconds: 3,
@@ -102,7 +102,7 @@
 ''', {});
       expect(
           metadata.timeout.duration,
-          equals(Duration(
+          equals(const Duration(
               hours: 1,
               minutes: 2,
               seconds: 3,
@@ -122,7 +122,7 @@
 ''', {});
       expect(
           metadata.timeout.duration,
-          equals(Duration(
+          equals(const Duration(
               hours: 1,
               minutes: 2,
               seconds: 3,
diff --git a/pkgs/test/test/runner/pause_after_load_test.dart b/pkgs/test/test/runner/pause_after_load_test.dart
index 691a86d..faba441 100644
--- a/pkgs/test/test/runner/pause_after_load_test.dart
+++ b/pkgs/test/test/runner/pause_after_load_test.dart
@@ -56,7 +56,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
@@ -76,7 +76,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
@@ -122,7 +122,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
@@ -144,7 +144,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
@@ -165,7 +165,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
@@ -232,7 +232,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
@@ -272,7 +272,7 @@
 
     // Wait a little bit to be sure that the tests don't start running without
     // our input.
-    await Future.delayed(Duration(seconds: 2));
+    await Future<void>.delayed(const Duration(seconds: 2));
     expect(nextLineFired, isFalse);
 
     test.stdin.writeln();
diff --git a/pkgs/test/test/runner/signal_test.dart b/pkgs/test/test/runner/signal_test.dart
index 8a093d9..d14ee97 100644
--- a/pkgs/test/test/runner/signal_test.dart
+++ b/pkgs/test/test/runner/signal_test.dart
@@ -70,7 +70,7 @@
       // TODO(nweiz): Sending two signals in close succession can cause the
       // second one to be ignored, so we wait a bit before the second
       // one. Remove this hack when issue 23047 is fixed.
-      await Future.delayed(Duration(seconds: 1));
+      await Future<void>.delayed(const Duration(seconds: 1));
 
       await signalAndQuit(test);
     });
@@ -179,7 +179,7 @@
       // TODO(nweiz): Sending two signals in close succession can cause the
       // second one to be ignored, so we wait a bit before the second
       // one. Remove this hack when issue 23047 is fixed.
-      await Future.delayed(Duration(seconds: 1));
+      await Future<void>.delayed(const Duration(seconds: 1));
       await signalAndQuit(test);
     });
 
diff --git a/pkgs/test/tool/host.dart b/pkgs/test/tool/host.dart
index b9b803b..582f651 100644
--- a/pkgs/test/tool/host.dart
+++ b/pkgs/test/tool/host.dart
@@ -137,7 +137,7 @@
 
     // Send periodic pings to the test runner so it can know when the browser is
     // paused for debugging.
-    Timer.periodic(Duration(seconds: 1),
+    Timer.periodic(const Duration(seconds: 1),
         (_) => serverChannel.sink.add({'command': 'ping'}));
 
     var play = dom.document.querySelector('#play');
@@ -167,7 +167,7 @@
   var webSocket =
       dom.createWebSocket(_currentUrl.queryParameters['managerUrl']!);
 
-  var controller = StreamChannelController(sync: true);
+  var controller = StreamChannelController<Object?>(sync: true);
   webSocket.addEventListener('message', allowInterop((message) {
     controller.local.sink
         .add(jsonDecode((message as dom.MessageEvent).data as String));
@@ -205,7 +205,7 @@
   dom.window.console.log('Starting suite $suiteUrl');
   var iframe = dom.createHTMLIFrameElement();
   _iframes[id] = iframe;
-  var controller = StreamChannelController(sync: true);
+  var controller = StreamChannelController<Object?>(sync: true);
 
   late dom.Subscription windowSubscription;
   windowSubscription =
diff --git a/pkgs/test_api/lib/src/backend/declarer.dart b/pkgs/test_api/lib/src/backend/declarer.dart
index c3686dd..53dba0b 100644
--- a/pkgs/test_api/lib/src/backend/declarer.dart
+++ b/pkgs/test_api/lib/src/backend/declarer.dart
@@ -60,7 +60,7 @@
   final _setUpAlls = <dynamic Function()>[];
 
   /// The default timeout for synthetic tests.
-  final _timeout = Timeout(Duration(minutes: 12));
+  final _timeout = const Timeout(Duration(minutes: 12));
 
   /// The trace for the first call to [setUpAll].
   ///
@@ -70,7 +70,7 @@
   Trace? _setUpAllTrace;
 
   /// The tear-down functions to run once for this group.
-  final _tearDownAlls = <Function()>[];
+  final _tearDownAlls = <void Function()>[];
 
   /// The trace for the first call to [tearDownAll].
   ///
diff --git a/pkgs/test_api/lib/src/backend/invoker.dart b/pkgs/test_api/lib/src/backend/invoker.dart
index 0274f90..58f1001 100644
--- a/pkgs/test_api/lib/src/backend/invoker.dart
+++ b/pkgs/test_api/lib/src/backend/invoker.dart
@@ -35,7 +35,7 @@
   final bool isScaffoldAll;
 
   /// The test body.
-  final Function() _body;
+  final void Function() _body;
 
   /// Whether the test is run in its own error zone.
   final bool _guarded;
@@ -170,7 +170,7 @@
   Timer? _timeoutTimer;
 
   /// The tear-down functions to run when this test finishes.
-  final _tearDowns = <Function()>[];
+  final _tearDowns = <void Function()>[];
 
   /// Messages to print if and when this test fails.
   final _printsOnFailure = <String>[];
@@ -229,7 +229,7 @@
     heartbeat();
     return runZoned(() async {
       while (tearDowns.isNotEmpty) {
-        var completer = Completer();
+        var completer = Completer<void>();
 
         addOutstandingCallback();
         _waitForOutstandingCallbacks(() {
diff --git a/pkgs/test_api/lib/src/backend/metadata.dart b/pkgs/test_api/lib/src/backend/metadata.dart
index 3455a04..d0663b1 100644
--- a/pkgs/test_api/lib/src/backend/metadata.dart
+++ b/pkgs/test_api/lib/src/backend/metadata.dart
@@ -123,7 +123,7 @@
   /// Parses a user-provided [String] or [Iterable] into the value for [tags].
   ///
   /// Throws an [ArgumentError] if [tags] is not a [String] or an [Iterable].
-  static Set<String> _parseTags(tags) {
+  static Set<String> _parseTags(Object? tags) {
     if (tags == null) return {};
     if (tags is String) return {tags};
     if (tags is! Iterable) {
@@ -231,7 +231,7 @@
       bool? chainStackTraces,
       int? retry,
       Map<String, dynamic>? onPlatform,
-      tags,
+      Object? /* String|Iterable<String> */ tags,
       this.languageVersionComment})
       : testOn = testOn == null
             ? PlatformSelector.all
@@ -255,7 +255,7 @@
   }
 
   /// Deserializes the result of [Metadata.serialize] into a new [Metadata].
-  Metadata.deserialize(serialized)
+  Metadata.deserialize(Map serialized)
       : testOn = serialized['testOn'] == null
             ? PlatformSelector.all
             : PlatformSelector.parse(serialized['testOn'] as String),
@@ -269,18 +269,18 @@
         onPlatform = {
           for (var pair in serialized['onPlatform'] as List)
             PlatformSelector.parse(pair.first as String):
-                Metadata.deserialize(pair.last)
+                Metadata.deserialize(pair.last as Map)
         },
         forTag = (serialized['forTag'] as Map).map((key, nested) => MapEntry(
             BooleanSelector.parse(key as String),
-            Metadata.deserialize(nested))),
+            Metadata.deserialize(nested as Map))),
         languageVersionComment =
             serialized['languageVersionComment'] as String?;
 
   /// Deserializes timeout from the format returned by [_serializeTimeout].
-  static Timeout _deserializeTimeout(serialized) {
+  static Timeout _deserializeTimeout(Object? serialized) {
     if (serialized == 'none') return Timeout.none;
-    var scaleFactor = serialized['scaleFactor'];
+    var scaleFactor = (serialized as Map)['scaleFactor'];
     if (scaleFactor != null) return Timeout.factor(scaleFactor as num);
     return Timeout(
         Duration(microseconds: (serialized['duration'] as num).toInt()));
@@ -388,7 +388,7 @@
   /// [Metadata.deserialize].
   Map<String, dynamic> serialize() {
     // Make this a list to guarantee that the order is preserved.
-    var serializedOnPlatform = [];
+    var serializedOnPlatform = <List<Object>>[];
     onPlatform.forEach((key, value) {
       serializedOnPlatform.add([key.toString(), value.serialize()]);
     });
diff --git a/pkgs/test_api/lib/src/backend/remote_exception.dart b/pkgs/test_api/lib/src/backend/remote_exception.dart
index 560f70e..0d70561 100644
--- a/pkgs/test_api/lib/src/backend/remote_exception.dart
+++ b/pkgs/test_api/lib/src/backend/remote_exception.dart
@@ -84,6 +84,5 @@
 /// It's important to preserve [TestFailure]-ness, because tests have different
 /// results depending on whether an exception was a failure or an error.
 final class _RemoteTestFailure extends RemoteException implements TestFailure {
-  _RemoteTestFailure(String? message, String type, String toString)
-      : super._(message, type, toString);
+  _RemoteTestFailure(super.message, super.type, super.toString) : super._();
 }
diff --git a/pkgs/test_api/lib/src/backend/remote_listener.dart b/pkgs/test_api/lib/src/backend/remote_listener.dart
index f47c4ea..9d67627 100644
--- a/pkgs/test_api/lib/src/backend/remote_listener.dart
+++ b/pkgs/test_api/lib/src/backend/remote_listener.dart
@@ -76,7 +76,7 @@
           return;
         }
 
-        if (main is! Function()) {
+        if (main is! FutureOr<void> Function()) {
           _sendLoadException(
               channel, 'Top-level main() function takes arguments.');
           return;
@@ -98,7 +98,7 @@
         });
 
         if ((message['asciiGlyphs'] as bool?) ?? false) glyph.ascii = true;
-        var metadata = Metadata.deserialize(message['metadata']);
+        var metadata = Metadata.deserialize(message['metadata'] as Map);
         verboseChain = metadata.verboseTrace;
         var declarer = Declarer(
           metadata: metadata,
diff --git a/pkgs/test_api/lib/src/scaffolding/spawn_hybrid.dart b/pkgs/test_api/lib/src/scaffolding/spawn_hybrid.dart
index 2186894..7222d52 100644
--- a/pkgs/test_api/lib/src/scaffolding/spawn_hybrid.dart
+++ b/pkgs/test_api/lib/src/scaffolding/spawn_hybrid.dart
@@ -170,7 +170,7 @@
   });
 
   if (!stayAlive) {
-    var disconnector = Disconnector();
+    var disconnector = Disconnector<void>();
     addTearDown(() => disconnector.disconnect());
     isolateChannel = isolateChannel.transform(disconnector);
   }
diff --git a/pkgs/test_api/test/backend/declarer_test.dart b/pkgs/test_api/test/backend/declarer_test.dart
index 0fe848a..f095ad0 100644
--- a/pkgs/test_api/test/backend/declarer_test.dart
+++ b/pkgs/test_api/test/backend/declarer_test.dart
@@ -228,7 +228,7 @@
         });
 
         test('description', () {
-          Future.error('oh no');
+          Future<Never>.error('oh no');
           return pumpEventQueue().then((_) {
             hasTestFinished = true;
           });
@@ -336,7 +336,7 @@
       var testGroup = entries.single as Group;
       expect(testGroup.name, equals('group'));
       expect(testGroup.entries, hasLength(1));
-      expect(testGroup.entries.single, TypeMatcher<Test>());
+      expect(testGroup.entries.single, const TypeMatcher<Test>());
       expect(testGroup.entries.single.name, 'group description');
     });
 
@@ -351,57 +351,57 @@
       var testGroup = entries.single as Group;
       expect(testGroup.name, equals('Object'));
       expect(testGroup.entries, hasLength(1));
-      expect(testGroup.entries.single, TypeMatcher<Test>());
+      expect(testGroup.entries.single, const TypeMatcher<Test>());
       expect(testGroup.entries.single.name, 'Object description');
     });
 
     test("a test's timeout factor is applied to the group's", () {
       var entries = declare(() {
         group('group', () {
-          test('test', () {}, timeout: Timeout.factor(3));
-        }, timeout: Timeout.factor(2));
+          test('test', () {}, timeout: const Timeout.factor(3));
+        }, timeout: const Timeout.factor(2));
       });
 
       expect(entries, hasLength(1));
       var testGroup = entries.single as Group;
       expect(testGroup.metadata.timeout.scaleFactor, equals(2));
       expect(testGroup.entries, hasLength(1));
-      expect(testGroup.entries.single, TypeMatcher<Test>());
+      expect(testGroup.entries.single, const TypeMatcher<Test>());
       expect(testGroup.entries.single.metadata.timeout.scaleFactor, equals(6));
     });
 
     test("a test's timeout factor is applied to the group's duration", () {
       var entries = declare(() {
         group('group', () {
-          test('test', () {}, timeout: Timeout.factor(2));
-        }, timeout: Timeout(Duration(seconds: 10)));
+          test('test', () {}, timeout: const Timeout.factor(2));
+        }, timeout: const Timeout(Duration(seconds: 10)));
       });
 
       expect(entries, hasLength(1));
       var testGroup = entries.single as Group;
-      expect(
-          testGroup.metadata.timeout.duration, equals(Duration(seconds: 10)));
+      expect(testGroup.metadata.timeout.duration,
+          equals(const Duration(seconds: 10)));
       expect(testGroup.entries, hasLength(1));
-      expect(testGroup.entries.single, TypeMatcher<Test>());
+      expect(testGroup.entries.single, const TypeMatcher<Test>());
       expect(testGroup.entries.single.metadata.timeout.duration,
-          equals(Duration(seconds: 20)));
+          equals(const Duration(seconds: 20)));
     });
 
     test("a test's timeout duration is applied over the group's", () {
       var entries = declare(() {
         group('group', () {
-          test('test', () {}, timeout: Timeout(Duration(seconds: 15)));
-        }, timeout: Timeout(Duration(seconds: 10)));
+          test('test', () {}, timeout: const Timeout(Duration(seconds: 15)));
+        }, timeout: const Timeout(Duration(seconds: 10)));
       });
 
       expect(entries, hasLength(1));
       var testGroup = entries.single as Group;
-      expect(
-          testGroup.metadata.timeout.duration, equals(Duration(seconds: 10)));
+      expect(testGroup.metadata.timeout.duration,
+          equals(const Duration(seconds: 10)));
       expect(testGroup.entries, hasLength(1));
-      expect(testGroup.entries.single, TypeMatcher<Test>());
+      expect(testGroup.entries.single, const TypeMatcher<Test>());
       expect(testGroup.entries.single.metadata.timeout.duration,
-          equals(Duration(seconds: 15)));
+          equals(const Duration(seconds: 15)));
     });
 
     test('disallows asynchronous groups', () async {
diff --git a/pkgs/test_api/test/backend/invoker_test.dart b/pkgs/test_api/test/backend/invoker_test.dart
index 55e697b..ef08b38 100644
--- a/pkgs/test_api/test/backend/invoker_test.dart
+++ b/pkgs/test_api/test/backend/invoker_test.dart
@@ -42,7 +42,7 @@
     test('returns the current invoker in a test body after the test completes',
         () async {
       Status? status;
-      var completer = Completer();
+      var completer = Completer<Invoker>();
       var liveTest = _localTest(() {
         // Use the event loop to wait longer than a microtask for the test to
         // complete.
@@ -432,7 +432,8 @@
         Invoker.current!.addOutstandingCallback();
       },
               metadata: Metadata(
-                  chainStackTraces: true, timeout: Timeout(Duration.zero)))
+                  chainStackTraces: true,
+                  timeout: const Timeout(Duration.zero)))
           .load(suite);
 
       expectStates(liveTest, [
@@ -443,7 +444,7 @@
       expectErrors(liveTest, [
         (error) {
           expect(lastState!.status, equals(Status.complete));
-          expect(error, TypeMatcher<TimeoutException>());
+          expect(error, const TypeMatcher<TimeoutException>());
         }
       ]);
 
@@ -453,10 +454,11 @@
     test('can be ignored', () {
       suite = Suite(Group.root([]), suitePlatform, ignoreTimeouts: true);
       var liveTest = _localTest(() async {
-        await Future.delayed(Duration(milliseconds: 10));
+        await Future<void>.delayed(const Duration(milliseconds: 10));
       },
               metadata: Metadata(
-                  chainStackTraces: true, timeout: Timeout(Duration.zero)))
+                  chainStackTraces: true,
+                  timeout: const Timeout(Duration.zero)))
           .load(suite);
 
       expectStates(liveTest, [
diff --git a/pkgs/test_api/test/backend/metadata_test.dart b/pkgs/test_api/test/backend/metadata_test.dart
index c9a0f78..f42a535 100644
--- a/pkgs/test_api/test/backend/metadata_test.dart
+++ b/pkgs/test_api/test/backend/metadata_test.dart
@@ -135,8 +135,8 @@
   group('onPlatform', () {
     test('parses a valid map', () {
       var metadata = Metadata.parse(onPlatform: {
-        'chrome': Timeout.factor(2),
-        'vm': [Skip(), Timeout.factor(3)]
+        'chrome': const Timeout.factor(2),
+        'vm': [const Skip(), const Timeout.factor(3)]
       });
 
       var key = metadata.onPlatform.keys.first;
@@ -157,28 +157,28 @@
 
     test('refuses an invalid value', () {
       expect(() {
-        Metadata.parse(onPlatform: {'chrome': TestOn('chrome')});
+        Metadata.parse(onPlatform: {'chrome': const TestOn('chrome')});
       }, throwsArgumentError);
     });
 
     test('refuses an invalid value in a list', () {
       expect(() {
         Metadata.parse(onPlatform: {
-          'chrome': [TestOn('chrome')]
+          'chrome': [const TestOn('chrome')]
         });
       }, throwsArgumentError);
     });
 
     test('refuses an invalid platform selector', () {
       expect(() {
-        Metadata.parse(onPlatform: {'vm &&': Skip()});
+        Metadata.parse(onPlatform: {'vm &&': const Skip()});
       }, throwsFormatException);
     });
 
     test('refuses multiple Timeouts', () {
       expect(() {
         Metadata.parse(onPlatform: {
-          'chrome': [Timeout.factor(2), Timeout.factor(3)]
+          'chrome': [const Timeout.factor(2), const Timeout.factor(3)]
         });
       }, throwsArgumentError);
     });
@@ -186,7 +186,7 @@
     test('refuses multiple Skips', () {
       expect(() {
         Metadata.parse(onPlatform: {
-          'chrome': [Skip(), Skip()]
+          'chrome': [const Skip(), const Skip()]
         });
       }, throwsArgumentError);
     });
@@ -194,7 +194,7 @@
 
   group('validatePlatformSelectors', () {
     test('succeeds if onPlatform uses valid platforms', () {
-      Metadata.parse(onPlatform: {'vm || browser': Skip()})
+      Metadata.parse(onPlatform: {'vm || browser': const Skip()})
           .validatePlatformSelectors({'vm'});
     });
 
@@ -208,7 +208,7 @@
 
     test('fails if onPlatform uses an invalid platform', () {
       expect(() {
-        Metadata.parse(onPlatform: {'unknown': Skip()})
+        Metadata.parse(onPlatform: {'unknown': const Skip()})
             .validatePlatformSelectors({'vm'});
       }, throwsFormatException);
     });
@@ -230,7 +230,7 @@
     test('preserves all fields if no parameters are passed', () {
       var metadata = Metadata(
           testOn: PlatformSelector.parse('linux'),
-          timeout: Timeout.factor(2),
+          timeout: const Timeout.factor(2),
           skip: true,
           skipReason: 'just because',
           verboseTrace: true,
@@ -242,15 +242,16 @@
             PlatformSelector.parse('mac-os'): Metadata(skip: false)
           },
           forTag: {
-            BooleanSelector.parse('slow'): Metadata(timeout: Timeout.factor(4))
+            BooleanSelector.parse('slow'):
+                Metadata(timeout: const Timeout.factor(4))
           });
       expect(metadata.serialize(), equals(metadata.change().serialize()));
     });
 
     test('updates a changed field', () {
-      var metadata = Metadata(timeout: Timeout.factor(2));
-      expect(metadata.change(timeout: Timeout.factor(3)).timeout,
-          equals(Timeout.factor(3)));
+      var metadata = Metadata(timeout: const Timeout.factor(2));
+      expect(metadata.change(timeout: const Timeout.factor(3)).timeout,
+          equals(const Timeout.factor(3)));
     });
   });
 }
diff --git a/pkgs/test_api/test/frontend/fake_test.dart b/pkgs/test_api/test/frontend/fake_test.dart
index bb82a7c..7dfb306 100644
--- a/pkgs/test_api/test/frontend/fake_test.dart
+++ b/pkgs/test_api/test/frontend/fake_test.dart
@@ -11,16 +11,16 @@
     fake = _FakeSample();
   });
   test('method invocation', () {
-    expect(() => fake.f(), throwsA(TypeMatcher<UnimplementedError>()));
+    expect(() => fake.f(), throwsA(const TypeMatcher<UnimplementedError>()));
   });
   test('getter', () {
-    expect(() => fake.x, throwsA(TypeMatcher<UnimplementedError>()));
+    expect(() => fake.x, throwsA(const TypeMatcher<UnimplementedError>()));
   });
   test('setter', () {
-    expect(() => fake.x = 0, throwsA(TypeMatcher<UnimplementedError>()));
+    expect(() => fake.x = 0, throwsA(const TypeMatcher<UnimplementedError>()));
   });
   test('operator', () {
-    expect(() => fake + 1, throwsA(TypeMatcher<UnimplementedError>()));
+    expect(() => fake + 1, throwsA(const TypeMatcher<UnimplementedError>()));
   });
 }
 
diff --git a/pkgs/test_api/test/frontend/timeout_test.dart b/pkgs/test_api/test/frontend/timeout_test.dart
index 14421f3..fdfd611 100644
--- a/pkgs/test_api/test/frontend/timeout_test.dart
+++ b/pkgs/test_api/test/frontend/timeout_test.dart
@@ -22,9 +22,9 @@
 
     group('for a relative timeout', () {
       test('successfully parses', () {
-        expect(Timeout.parse('1x'), equals(Timeout.factor(1)));
-        expect(Timeout.parse('2.5x'), equals(Timeout.factor(2.5)));
-        expect(Timeout.parse('1.2e3x'), equals(Timeout.factor(1.2e3)));
+        expect(Timeout.parse('1x'), equals(const Timeout.factor(1)));
+        expect(Timeout.parse('2.5x'), equals(const Timeout.factor(2.5)));
+        expect(Timeout.parse('1.2e3x'), equals(const Timeout.factor(1.2e3)));
       });
 
       test('rejects invalid input', () {
@@ -38,25 +38,27 @@
 
     group('for an absolute timeout', () {
       test('successfully parses all supported units', () {
-        expect(Timeout.parse('2d'), equals(Timeout(Duration(days: 2))));
-        expect(Timeout.parse('2h'), equals(Timeout(Duration(hours: 2))));
-        expect(Timeout.parse('2m'), equals(Timeout(Duration(minutes: 2))));
-        expect(Timeout.parse('2s'), equals(Timeout(Duration(seconds: 2))));
+        expect(Timeout.parse('2d'), equals(const Timeout(Duration(days: 2))));
+        expect(Timeout.parse('2h'), equals(const Timeout(Duration(hours: 2))));
         expect(
-            Timeout.parse('2ms'), equals(Timeout(Duration(milliseconds: 2))));
+            Timeout.parse('2m'), equals(const Timeout(Duration(minutes: 2))));
         expect(
-            Timeout.parse('2us'), equals(Timeout(Duration(microseconds: 2))));
+            Timeout.parse('2s'), equals(const Timeout(Duration(seconds: 2))));
+        expect(Timeout.parse('2ms'),
+            equals(const Timeout(Duration(milliseconds: 2))));
+        expect(Timeout.parse('2us'),
+            equals(const Timeout(Duration(microseconds: 2))));
       });
 
       test('supports non-integer units', () {
-        expect(
-            Timeout.parse('2.73d'), equals(Timeout(Duration(days: 1) * 2.73)));
+        expect(Timeout.parse('2.73d'),
+            equals(Timeout(const Duration(days: 1) * 2.73)));
       });
 
       test('supports multiple units', () {
         expect(
             Timeout.parse('1d 2h3m  4s5ms\t6us'),
-            equals(Timeout(Duration(
+            equals(const Timeout(Duration(
                 days: 1,
                 hours: 2,
                 minutes: 3,
diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md
index dd41564..f71b215 100644
--- a/pkgs/test_core/CHANGELOG.md
+++ b/pkgs/test_core/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 0.5.9-wip
+
 ## 0.5.8
 
 * Move scaffolding definitions to a non-deprecated library.
diff --git a/pkgs/test_core/lib/src/bootstrap/vm.dart b/pkgs/test_core/lib/src/bootstrap/vm.dart
index 2166e7d..a2e9f4b 100644
--- a/pkgs/test_core/lib/src/bootstrap/vm.dart
+++ b/pkgs/test_core/lib/src/bootstrap/vm.dart
@@ -9,13 +9,13 @@
 import 'package:stream_channel/isolate_channel.dart';
 import 'package:stream_channel/stream_channel.dart';
 
-import 'package:test_core/src/runner/plugin/remote_platform_helpers.dart';
-import 'package:test_core/src/runner/plugin/shared_platform_helpers.dart';
+import '../runner/plugin/remote_platform_helpers.dart';
+import '../runner/plugin/shared_platform_helpers.dart';
 
 /// Bootstraps a vm test to communicate with the test runner over an isolate.
 void internalBootstrapVmTest(Function Function() getMain, SendPort sendPort) {
   var platformChannel =
-      MultiChannel(IsolateChannel<Object?>.connectSend(sendPort));
+      MultiChannel<Object?>(IsolateChannel<Object?>.connectSend(sendPort));
   var testControlChannel = platformChannel.virtualChannel()
     ..pipe(serializeSuite(getMain));
   platformChannel.sink.add(testControlChannel.id);
diff --git a/pkgs/test_core/lib/src/executable.dart b/pkgs/test_core/lib/src/executable.dart
index 7b7978c..eeefd16 100644
--- a/pkgs/test_core/lib/src/executable.dart
+++ b/pkgs/test_core/lib/src/executable.dart
@@ -10,11 +10,11 @@
 import 'package:source_span/source_span.dart';
 import 'package:stack_trace/stack_trace.dart';
 import 'package:test_api/src/backend/util/pretty_print.dart'; // ignore: implementation_imports
-import 'package:test_core/src/runner/no_tests_found_exception.dart';
 
 import 'runner.dart';
 import 'runner/application_exception.dart';
 import 'runner/configuration.dart';
+import 'runner/no_tests_found_exception.dart';
 import 'runner/version.dart';
 import 'util/errors.dart';
 import 'util/exit_codes.dart' as exit_codes;
@@ -64,7 +64,7 @@
   final signals = Platform.isWindows
       ? ProcessSignal.sigint.watch()
       : Platform.isFuchsia // Signals don't exist on Fuchsia.
-          ? Stream.empty()
+          ? const Stream<Never>.empty()
           : StreamGroup.merge(
               [ProcessSignal.sigterm.watch(), ProcessSignal.sigint.watch()]);
 
diff --git a/pkgs/test_core/lib/src/runner.dart b/pkgs/test_core/lib/src/runner.dart
index 8d7078a..ee648d4 100644
--- a/pkgs/test_core/lib/src/runner.dart
+++ b/pkgs/test_core/lib/src/runner.dart
@@ -16,7 +16,6 @@
 import 'package:test_api/src/backend/suite.dart'; // ignore: implementation_imports
 import 'package:test_api/src/backend/test.dart'; // ignore: implementation_imports
 import 'package:test_api/src/backend/util/pretty_print.dart'; // ignore: implementation_imports
-import 'package:test_core/src/runner/reporter/multiplex.dart';
 
 import 'runner/configuration.dart';
 import 'runner/configuration/reporters.dart';
@@ -29,6 +28,7 @@
 import 'runner/reporter.dart';
 import 'runner/reporter/compact.dart';
 import 'runner/reporter/expanded.dart';
+import 'runner/reporter/multiplex.dart';
 import 'runner/runner_suite.dart';
 import 'util/io.dart';
 
@@ -66,7 +66,7 @@
   CancelableOperation? _debugOperation;
 
   /// The memoizer for ensuring [close] only runs once.
-  final _closeMemo = AsyncMemoizer();
+  final _closeMemo = AsyncMemoizer<void>();
   bool get _closed => _closeMemo.hasRun;
 
   /// Sinks created for each file reporter (if there are any).
@@ -128,7 +128,9 @@
           var subscription =
               _suiteSubscription = suites.listen(_engine.suiteSink.add);
           var results = await Future.wait(<Future>[
-            subscription.asFuture().then((_) => _engine.suiteSink.close()),
+            subscription
+                .asFuture<void>()
+                .then((_) => _engine.suiteSink.close()),
             _engine.run()
           ], eagerError: true);
           success = results.last as bool?;
@@ -175,7 +177,7 @@
     if (unsupportedRuntimes.isEmpty) return;
 
     // Human-readable names for all unsupported runtimes.
-    var unsupportedNames = [];
+    var unsupportedNames = <String>[];
 
     // If the user tried to run on one or more unsupported browsers, figure out
     // whether we should warn about the individual browsers or whether all
@@ -223,7 +225,7 @@
         if (!_engine.isIdle) {
           // Wait a bit to print this message, since printing it eagerly looks weird
           // if the tests then finish immediately.
-          timer = Timer(Duration(seconds: 1), () {
+          timer = Timer(const Duration(seconds: 1), () {
             // Pause the reporter while we print to ensure that we don't interfere
             // with its output.
             _reporter.pause();
@@ -465,7 +467,7 @@
     }).listen(null);
 
     var results = await Future.wait(<Future>[
-      subscription.asFuture().then((_) => _engine.suiteSink.close()),
+      subscription.asFuture<void>().then((_) => _engine.suiteSink.close()),
       _engine.run()
     ], eagerError: true);
     return results.last as bool;
diff --git a/pkgs/test_core/lib/src/runner/compiler_pool.dart b/pkgs/test_core/lib/src/runner/compiler_pool.dart
index e7945c2..52aa238 100644
--- a/pkgs/test_core/lib/src/runner/compiler_pool.dart
+++ b/pkgs/test_core/lib/src/runner/compiler_pool.dart
@@ -25,7 +25,7 @@
   bool get closed => _closeMemo.hasRun;
 
   /// The memoizer for running [close] exactly once.
-  final _closeMemo = AsyncMemoizer();
+  final _closeMemo = AsyncMemoizer<void>();
 
   /// Creates a compiler pool that multiple instances of a compiler at once.
   CompilerPool() : _pool = Pool(Configuration.current.concurrency);
diff --git a/pkgs/test_core/lib/src/runner/configuration/args.dart b/pkgs/test_core/lib/src/runner/configuration/args.dart
index 7489d5e..fac1224 100644
--- a/pkgs/test_core/lib/src/runner/configuration/args.dart
+++ b/pkgs/test_core/lib/src/runner/configuration/args.dart
@@ -217,7 +217,7 @@
   final col = uri.queryParameters['col'];
 
   if (names != null && names.isNotEmpty && fullName != null) {
-    throw FormatException(
+    throw const FormatException(
       'Cannot specify both "name=<...>" and "full-name=<...>".',
     );
   }
@@ -270,13 +270,13 @@
     var shardIndex = _parseOption('shard-index', int.parse);
     var totalShards = _parseOption('total-shards', int.parse);
     if ((shardIndex == null) != (totalShards == null)) {
-      throw FormatException(
+      throw const FormatException(
           '--shard-index and --total-shards may only be passed together.');
     } else if (shardIndex != null) {
       if (shardIndex < 0) {
-        throw FormatException('--shard-index may not be negative.');
+        throw const FormatException('--shard-index may not be negative.');
       } else if (shardIndex >= totalShards!) {
-        throw FormatException(
+        throw const FormatException(
             '--shard-index must be less than --total-shards.');
       }
     }
@@ -304,7 +304,7 @@
     var compilerSelections = _ifParsed<List<String>>('compiler')
         ?.map(CompilerSelection.parse)
         .toList();
-    if (_ifParsed('use-data-isolate-strategy') == true) {
+    if (_ifParsed<bool>('use-data-isolate-strategy') == true) {
       compilerSelections ??= [];
       compilerSelections.add(CompilerSelection.parse('vm:source'));
     }
@@ -393,7 +393,7 @@
   Map<String, String>? _parseFileReporterOption() =>
       _parseOption('file-reporter', (value) {
         if (!value.contains(':')) {
-          throw FormatException(
+          throw const FormatException(
               'option must be in the form <reporter>:<filepath>, e.g. '
               '"json:reports/tests.json"');
         }
diff --git a/pkgs/test_core/lib/src/runner/dart2js_compiler_pool.dart b/pkgs/test_core/lib/src/runner/dart2js_compiler_pool.dart
index a1e7fc8..343ce0c 100644
--- a/pkgs/test_core/lib/src/runner/dart2js_compiler_pool.dart
+++ b/pkgs/test_core/lib/src/runner/dart2js_compiler_pool.dart
@@ -100,7 +100,7 @@
     var map = jsonDecode(File(mapPath).readAsStringSync());
     var root = map['sourceRoot'] as String;
 
-    map['sources'] = map['sources'].map((source) {
+    map['sources'] = map['sources'].map((Object? source) {
       var url = Uri.parse('$root$source');
       if (url.scheme != '' && url.scheme != 'file') return source;
       if (url.path.endsWith('/runInBrowser.dart')) return '';
diff --git a/pkgs/test_core/lib/src/runner/debugger.dart b/pkgs/test_core/lib/src/runner/debugger.dart
index a24bd1f..5e59d88 100644
--- a/pkgs/test_core/lib/src/runner/debugger.dart
+++ b/pkgs/test_core/lib/src/runner/debugger.dart
@@ -70,7 +70,7 @@
 
   /// A completer that's used to manually unpause the test if the debugger is
   /// closed.
-  final _pauseCompleter = CancelableCompleter();
+  final _pauseCompleter = CancelableCompleter<void>();
 
   /// The subscription to [_suite.onDebugging].
   StreamSubscription<bool>? _onDebuggingSubscription;
diff --git a/pkgs/test_core/lib/src/runner/engine.dart b/pkgs/test_core/lib/src/runner/engine.dart
index 665fd60..0aa29e6 100644
--- a/pkgs/test_core/lib/src/runner/engine.dart
+++ b/pkgs/test_core/lib/src/runner/engine.dart
@@ -100,7 +100,7 @@
   }
 
   /// A group of futures for each test suite.
-  final _group = FutureGroup();
+  final _group = FutureGroup<void>();
 
   /// All of the engine's stream subscriptions.
   final _subscriptions = <StreamSubscription>{};
diff --git a/pkgs/test_core/lib/src/runner/environment.dart b/pkgs/test_core/lib/src/runner/environment.dart
index 6b28faa..7fcba66 100644
--- a/pkgs/test_core/lib/src/runner/environment.dart
+++ b/pkgs/test_core/lib/src/runner/environment.dart
@@ -39,7 +39,7 @@
   @override
   final supportsDebugging = false;
   @override
-  Stream get onRestart => StreamController.broadcast().stream;
+  Stream get onRestart => StreamController<void>.broadcast().stream;
 
   const PluginEnvironment();
 
diff --git a/pkgs/test_core/lib/src/runner/hybrid_listener.dart b/pkgs/test_core/lib/src/runner/hybrid_listener.dart
index bf2daa2..6a521db 100644
--- a/pkgs/test_core/lib/src/runner/hybrid_listener.dart
+++ b/pkgs/test_core/lib/src/runner/hybrid_listener.dart
@@ -33,7 +33,7 @@
 /// The [data] argument contains two values: a [SendPort] that communicates with
 /// the main isolate, and a message to pass to `hybridMain()`.
 void listen(Function Function() getMain, List data) {
-  var channel = IsolateChannel.connectSend(data.first as SendPort);
+  var channel = IsolateChannel<Object?>.connectSend(data.first as SendPort);
   var message = data.last;
 
   Chain.capture(() {
@@ -52,10 +52,10 @@
       if (main is! Function) {
         _sendError(channel, 'Top-level hybridMain is not a function.');
         return;
-      } else if (main is! Function(StreamChannel) &&
-          main is! Function(StreamChannel, Never)) {
-        if (main is Function(StreamChannel<Never>) ||
-            main is Function(StreamChannel<Never>, Never)) {
+      } else if (main is! void Function(StreamChannel) &&
+          main is! void Function(StreamChannel, Never)) {
+        if (main is void Function(StreamChannel<Never>) ||
+            main is void Function(StreamChannel<Never>, Never)) {
           _sendError(
               channel,
               'The first parameter to the top-level hybridMain() must be a '
@@ -72,7 +72,7 @@
       // errors and distinguish user data events from control events sent by the
       // listener.
       var transformedChannel = channel.transformSink(_transformer);
-      if (main is Function(StreamChannel)) {
+      if (main is void Function(StreamChannel)) {
         main(transformedChannel);
       } else {
         main(transformedChannel, message);
@@ -88,7 +88,7 @@
 }
 
 /// Sends a message over [channel] indicating an error from user code.
-void _sendError(StreamChannel channel, error, [StackTrace? stackTrace]) {
+void _sendError(StreamChannel channel, Object error, [StackTrace? stackTrace]) {
   channel.sink.add({
     'type': 'error',
     'error': RemoteException.serialize(error, stackTrace ?? Chain.current())
diff --git a/pkgs/test_core/lib/src/runner/live_suite_controller.dart b/pkgs/test_core/lib/src/runner/live_suite_controller.dart
index bc13e51..15bc797 100644
--- a/pkgs/test_core/lib/src/runner/live_suite_controller.dart
+++ b/pkgs/test_core/lib/src/runner/live_suite_controller.dart
@@ -66,12 +66,12 @@
   /// The future group that backs [LiveSuite.onComplete].
   ///
   /// This contains all the futures from tests that are run in this suite.
-  final _onCompleteGroup = FutureGroup();
+  final _onCompleteGroup = FutureGroup<void>();
 
   /// The completer that backs [LiveSuite.onClose].
   ///
   /// This is completed when the live suite is closed.
-  final _onCloseCompleter = Completer();
+  final _onCloseCompleter = Completer<void>();
 
   /// The controller for [LiveSuite.onTestStarted].
   final _onTestStartedController =
@@ -150,5 +150,5 @@
           _onCloseCompleter.complete();
         }
       });
-  final _closeMemo = AsyncMemoizer();
+  final _closeMemo = AsyncMemoizer<void>();
 }
diff --git a/pkgs/test_core/lib/src/runner/load_suite.dart b/pkgs/test_core/lib/src/runner/load_suite.dart
index db6b12e..d4263ea 100644
--- a/pkgs/test_core/lib/src/runner/load_suite.dart
+++ b/pkgs/test_core/lib/src/runner/load_suite.dart
@@ -28,7 +28,7 @@
 /// compiled with dart2js doesn't trigger it, but short enough that it fires
 /// before the host kills it. For example, Google's Forge service has a
 /// 15-minute timeout.
-final _timeout = Duration(minutes: 12);
+final _timeout = const Duration(minutes: 12);
 
 /// A [Suite] emitted by a [Loader] that provides a test-like interface for
 /// loading a test file.
@@ -201,7 +201,7 @@
     if (liveTest.errors.isEmpty) return await suite;
 
     var error = liveTest.errors.first;
-    await Future.error(error.error, error.stackTrace);
+    await Future<void>.error(error.error, error.stackTrace);
     throw 'unreachable';
   }
 
diff --git a/pkgs/test_core/lib/src/runner/loader.dart b/pkgs/test_core/lib/src/runner/loader.dart
index b3ec7e8..bc02454 100644
--- a/pkgs/test_core/lib/src/runner/loader.dart
+++ b/pkgs/test_core/lib/src/runner/loader.dart
@@ -11,10 +11,10 @@
 import 'package:test_api/src/backend/group.dart'; // ignore: implementation_imports
 import 'package:test_api/src/backend/invoker.dart'; // ignore: implementation_imports
 import 'package:test_api/src/backend/runtime.dart'; // ignore: implementation_imports
-import 'package:test_core/src/runner/compiler_selection.dart';
 import 'package:yaml/yaml.dart';
 
 import '../util/io.dart';
+import 'compiler_selection.dart';
 import 'configuration.dart';
 import 'hack_register_platform.dart';
 import 'load_exception.dart';
@@ -141,7 +141,7 @@
     return StreamGroup.merge(
         Directory(dir).listSync(recursive: true).map((entry) {
       if (entry is! File || !_config.filename.matches(p.basename(entry.path))) {
-        return Stream.empty();
+        return const Stream.empty();
       }
 
       return loadFile(entry.path, suiteConfig);
@@ -232,13 +232,13 @@
               if (retriesLeft > 0) {
                 retriesLeft--;
                 print('Retrying load of $path in 1s ($retriesLeft remaining)');
-                await Future.delayed(Duration(seconds: 1));
+                await Future<void>.delayed(const Duration(seconds: 1));
                 continue;
               }
               if (error is LoadException) {
                 rethrow;
               }
-              await Future.error(LoadException(path, error), stackTrace);
+              await Future<void>.error(LoadException(path, error), stackTrace);
               return null;
             }
           }
@@ -301,5 +301,5 @@
         _platformCallbacks.clear();
         _suites.clear();
       });
-  final _closeMemo = AsyncMemoizer();
+  final _closeMemo = AsyncMemoizer<void>();
 }
diff --git a/pkgs/test_core/lib/src/runner/plugin/environment.dart b/pkgs/test_core/lib/src/runner/plugin/environment.dart
index a097842..7558d62 100644
--- a/pkgs/test_core/lib/src/runner/plugin/environment.dart
+++ b/pkgs/test_core/lib/src/runner/plugin/environment.dart
@@ -13,7 +13,7 @@
   @override
   final supportsDebugging = false;
   @override
-  Stream get onRestart => StreamController.broadcast().stream;
+  Stream<void> get onRestart => StreamController<void>.broadcast().stream;
 
   const PluginEnvironment();
 
diff --git a/pkgs/test_core/lib/src/runner/plugin/platform_helpers.dart b/pkgs/test_core/lib/src/runner/plugin/platform_helpers.dart
index 569ef60..450dedb 100644
--- a/pkgs/test_core/lib/src/runner/plugin/platform_helpers.dart
+++ b/pkgs/test_core/lib/src/runner/plugin/platform_helpers.dart
@@ -131,7 +131,7 @@
 
   /// Deserializes [group] into a concrete [Group].
   Group deserializeGroup(Map group) {
-    var metadata = Metadata.deserialize(group['metadata']);
+    var metadata = Metadata.deserialize(group['metadata'] as Map);
     return Group(
         group['name'] as String,
         (group['entries'] as List).map((entry) {
@@ -153,7 +153,7 @@
   Test? _deserializeTest(Map? test) {
     if (test == null) return null;
 
-    var metadata = Metadata.deserialize(test['metadata']);
+    var metadata = Metadata.deserialize(test['metadata'] as Map);
     var trace =
         test['trace'] == null ? null : Trace.parse(test['trace'] as String);
     var testChannel = _channel.virtualChannel((test['channel'] as num).toInt());
diff --git a/pkgs/test_core/lib/src/runner/reporter/compact.dart b/pkgs/test_core/lib/src/runner/reporter/compact.dart
index 962213f..13ccd11 100644
--- a/pkgs/test_core/lib/src/runner/reporter/compact.dart
+++ b/pkgs/test_core/lib/src/runner/reporter/compact.dart
@@ -191,7 +191,7 @@
       _stopwatch.start();
 
       // Keep updating the time even when nothing else is happening.
-      _subscriptions.add(Stream.periodic(Duration(seconds: 1))
+      _subscriptions.add(Stream<void>.periodic(const Duration(seconds: 1))
           .listen((_) => _progressLine(_lastProgressMessage ?? '')));
     }
 
@@ -252,7 +252,7 @@
   }
 
   /// A callback called when [liveTest] throws [error].
-  void _onError(LiveTest liveTest, error, StackTrace stackTrace) {
+  void _onError(LiveTest liveTest, Object error, StackTrace stackTrace) {
     if (!liveTest.test.metadata.chainStackTraces &&
         !liveTest.suite.isLoadSuite) {
       _shouldPrintStackTraceChainingNotice = true;
diff --git a/pkgs/test_core/lib/src/runner/reporter/expanded.dart b/pkgs/test_core/lib/src/runner/reporter/expanded.dart
index a654528..be2016c 100644
--- a/pkgs/test_core/lib/src/runner/reporter/expanded.dart
+++ b/pkgs/test_core/lib/src/runner/reporter/expanded.dart
@@ -200,7 +200,7 @@
   }
 
   /// A callback called when [liveTest] throws [error].
-  void _onError(LiveTest liveTest, error, StackTrace stackTrace) {
+  void _onError(LiveTest liveTest, Object error, StackTrace stackTrace) {
     if (!liveTest.test.metadata.chainStackTraces &&
         !liveTest.suite.isLoadSuite) {
       _shouldPrintStackTraceChainingNotice = true;
diff --git a/pkgs/test_core/lib/src/runner/reporter/json.dart b/pkgs/test_core/lib/src/runner/reporter/json.dart
index 0683b60..662af03 100644
--- a/pkgs/test_core/lib/src/runner/reporter/json.dart
+++ b/pkgs/test_core/lib/src/runner/reporter/json.dart
@@ -261,7 +261,7 @@
   }
 
   /// A callback called when [liveTest] throws [error].
-  void _onError(LiveTest liveTest, error, StackTrace stackTrace) {
+  void _onError(LiveTest liveTest, Object error, StackTrace stackTrace) {
     _emit('error', {
       'testID': _liveTestIDs[liveTest],
       'error': error.toString(),
diff --git a/pkgs/test_core/lib/src/runner/runner_suite.dart b/pkgs/test_core/lib/src/runner/runner_suite.dart
index 277a5ff..dcceb6b 100644
--- a/pkgs/test_core/lib/src/runner/runner_suite.dart
+++ b/pkgs/test_core/lib/src/runner/runner_suite.dart
@@ -48,7 +48,7 @@
   /// debugging mode and doesn't support suite channels.
   factory RunnerSuite(Environment environment, SuiteConfiguration config,
       Group group, SuitePlatform platform,
-      {String? path, Function()? onClose}) {
+      {String? path, void Function()? onClose}) {
     var controller =
         RunnerSuiteController._local(environment, config, onClose: onClose);
     var suite = RunnerSuite._(controller, group, platform, path: path);
@@ -95,7 +95,7 @@
   final MultiChannel? _suiteChannel;
 
   /// The function to call when the suite is closed.
-  final Function()? _onClose;
+  final FutureOr<void> Function()? _onClose;
 
   /// The backing value for [suite.isDebugging].
   bool _isDebugging = false;
@@ -112,7 +112,7 @@
   RunnerSuiteController(this._environment, this._config, this._suiteChannel,
       Future<Group> groupFuture, SuitePlatform platform,
       {String? path,
-      Function()? onClose,
+      void Function()? onClose,
       Future<Map<String, dynamic>> Function()? gatherCoverage})
       : _onClose = onClose,
         _gatherCoverage = gatherCoverage {
@@ -123,7 +123,7 @@
   /// Used by [RunnerSuite.new] to create a runner suite that's not loaded from
   /// an external source.
   RunnerSuiteController._local(this._environment, this._config,
-      {Function()? onClose,
+      {void Function()? onClose,
       Future<Map<String, dynamic>> Function()? gatherCoverage})
       : _suiteChannel = null,
         _onClose = onClose,
@@ -171,5 +171,5 @@
         var onClose = _onClose;
         if (onClose != null) await onClose();
       });
-  final _closeMemo = AsyncMemoizer();
+  final _closeMemo = AsyncMemoizer<void>();
 }
diff --git a/pkgs/test_core/lib/src/runner/spawn_hybrid.dart b/pkgs/test_core/lib/src/runner/spawn_hybrid.dart
index e44e05d..ed236b0 100644
--- a/pkgs/test_core/lib/src/runner/spawn_hybrid.dart
+++ b/pkgs/test_core/lib/src/runner/spawn_hybrid.dart
@@ -50,14 +50,14 @@
           onExit: onExitPort.sendPort);
 
       // Ensure that we close [port] and [channel] when the isolate exits.
-      var disconnector = Disconnector();
+      var disconnector = Disconnector<void>();
       onExitPort.listen((_) {
         disconnector.disconnect();
         port.close();
         onExitPort.close();
       });
 
-      return IsolateChannel.connectReceive(port)
+      return IsolateChannel<Object?>.connectReceive(port)
           .transform(disconnector)
           .transformSink(StreamSinkTransformer.fromHandlers(handleDone: (sink) {
         // If the user closes the stream channel, kill the isolate.
@@ -76,7 +76,7 @@
             'type': 'error',
             'error': RemoteException.serialize(error, stackTrace)
           })),
-          NullStreamSink());
+          NullStreamSink<void>());
     }
   }());
 }
diff --git a/pkgs/test_core/lib/src/runner/vm/environment.dart b/pkgs/test_core/lib/src/runner/vm/environment.dart
index 057a03a..76cc2fd 100644
--- a/pkgs/test_core/lib/src/runner/vm/environment.dart
+++ b/pkgs/test_core/lib/src/runner/vm/environment.dart
@@ -5,9 +5,10 @@
 import 'dart:async';
 
 import 'package:async/async.dart';
-import 'package:test_core/src/runner/environment.dart'; // ignore: implementation_imports
 import 'package:vm_service/vm_service.dart';
 
+import '../environment.dart'; // ignore: implementation_imports
+
 /// The environment in which VM tests are loaded.
 class VMEnvironment implements Environment {
   @override
@@ -25,12 +26,12 @@
   Uri? get remoteDebuggerUrl => null;
 
   @override
-  Stream get onRestart => StreamController.broadcast().stream;
+  Stream<void> get onRestart => StreamController<void>.broadcast().stream;
 
   @override
-  CancelableOperation displayPause() {
+  CancelableOperation<void> displayPause() {
     var completer =
-        CancelableCompleter(onCancel: () => _client.resume(_isolate.id!));
+        CancelableCompleter<void>(onCancel: () => _client.resume(_isolate.id!));
 
     completer.complete(_client.pause(_isolate.id!).then((_) => _client
         .onDebugEvent
diff --git a/pkgs/test_core/lib/src/runner/vm/platform.dart b/pkgs/test_core/lib/src/runner/vm/platform.dart
index 2cb5a48..9ab7892 100644
--- a/pkgs/test_core/lib/src/runner/vm/platform.dart
+++ b/pkgs/test_core/lib/src/runner/vm/platform.dart
@@ -14,7 +14,6 @@
 import 'package:stream_channel/isolate_channel.dart';
 import 'package:stream_channel/stream_channel.dart';
 import 'package:test_api/backend.dart';
-import 'package:test_core/src/runner/vm/test_compiler.dart';
 import 'package:vm_service/vm_service.dart' hide Isolate;
 import 'package:vm_service/vm_service_io.dart';
 
@@ -30,6 +29,7 @@
 import '../../util/package_config.dart';
 import '../package_version.dart';
 import 'environment.dart';
+import 'test_compiler.dart';
 
 var _shouldPauseAfterTests = false;
 
@@ -136,7 +136,7 @@
       environment = VMEnvironment(url, isolateRef, client);
     }
 
-    environment ??= PluginEnvironment();
+    environment ??= const PluginEnvironment();
 
     var controller = deserializeSuite(
         path, platform, suiteConfig, environment, channel.cast(), message,
diff --git a/pkgs/test_core/lib/src/runner/vm/test_compiler.dart b/pkgs/test_core/lib/src/runner/vm/test_compiler.dart
index ba3c4b7..c34b4f6 100644
--- a/pkgs/test_core/lib/src/runner/vm/test_compiler.dart
+++ b/pkgs/test_core/lib/src/runner/vm/test_compiler.dart
@@ -65,7 +65,7 @@
 }
 
 class _TestCompilerForLanguageVersion {
-  final _closeMemo = AsyncMemoizer();
+  final _closeMemo = AsyncMemoizer<void>();
   final _compilePool = Pool(1);
   final String _dillCachePath;
   FrontendServerClient? _frontendServerClient;
diff --git a/pkgs/test_core/lib/src/util/io.dart b/pkgs/test_core/lib/src/util/io.dart
index 9228437..98bb23b 100644
--- a/pkgs/test_core/lib/src/util/io.dart
+++ b/pkgs/test_core/lib/src/util/io.dart
@@ -66,8 +66,10 @@
 ///
 /// Also returns an empty stream for Fuchsia since Fuchsia components can't
 /// access stdin.
-StreamQueue<String> get stdinLines => _stdinLines ??= StreamQueue(
-    Platform.isFuchsia ? Stream<String>.empty() : lineSplitter.bind(stdin));
+StreamQueue<String> get stdinLines =>
+    _stdinLines ??= StreamQueue(Platform.isFuchsia
+        ? const Stream<String>.empty()
+        : lineSplitter.bind(stdin));
 
 StreamQueue<String>? _stdinLines;
 
@@ -239,7 +241,8 @@
       } on FileSystemException {
         if (attempt == 2) rethrow;
         attempt++;
-        await Future.delayed(Duration(milliseconds: pow(10, attempt).toInt()));
+        await Future<void>.delayed(
+            Duration(milliseconds: pow(10, attempt).toInt()));
       }
     }
   }
diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml
index 42aeb38..846cbe7 100644
--- a/pkgs/test_core/pubspec.yaml
+++ b/pkgs/test_core/pubspec.yaml
@@ -1,5 +1,5 @@
 name: test_core
-version: 0.5.8
+version: 0.5.9-wip
 description: A basic library for writing tests and running them on the VM.
 repository: https://github.com/dart-lang/test/tree/master/pkgs/test_core