Remove uses of deprecated test_api imports (#124732)

Most of these imports were never appropriate. The `test_api` package was never intended for use in `_test.dart` files.
Where possible move imports to `matcher`, otherwise move them to `test` or `flutter_test`.

Leave uses of `test_api` from `flutter_test` library code.
diff --git a/dev/integration_tests/flutter_gallery/test/calculator/logic.dart b/dev/integration_tests/flutter_gallery/test/calculator/logic.dart
index d8b07fd..b17079f 100644
--- a/dev/integration_tests/flutter_gallery/test/calculator/logic.dart
+++ b/dev/integration_tests/flutter_gallery/test/calculator/logic.dart
@@ -4,8 +4,7 @@
 
 import 'package:flutter_gallery/demo/calculator/logic.dart';
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
 
 void main() {
   test('Test order of operations: 12 + 3 * 4 = 24', () {
diff --git a/dev/missing_dependency_tests/trivial_test.dart b/dev/missing_dependency_tests/trivial_test.dart
index b38a69b..e67f087 100644
--- a/dev/missing_dependency_tests/trivial_test.dart
+++ b/dev/missing_dependency_tests/trivial_test.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
 
 void main() {
   test('Trivial test', () {
diff --git a/examples/layers/test/smoketests/raw/canvas_test.dart b/examples/layers/test/smoketests/raw/canvas_test.dart
index 9e725af..33c209b 100644
--- a/examples/layers/test/smoketests/raw/canvas_test.dart
+++ b/examples/layers/test/smoketests/raw/canvas_test.dart
@@ -2,8 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../raw/canvas.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/raw/hello_world_test.dart b/examples/layers/test/smoketests/raw/hello_world_test.dart
index 7c0b37b..505d344 100644
--- a/examples/layers/test/smoketests/raw/hello_world_test.dart
+++ b/examples/layers/test/smoketests/raw/hello_world_test.dart
@@ -2,8 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../raw/hello_world.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/raw/spinning_square_test.dart b/examples/layers/test/smoketests/raw/spinning_square_test.dart
index ff5caad..655f7eb 100644
--- a/examples/layers/test/smoketests/raw/spinning_square_test.dart
+++ b/examples/layers/test/smoketests/raw/spinning_square_test.dart
@@ -2,8 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../raw/spinning_square.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/raw/text_test.dart b/examples/layers/test/smoketests/raw/text_test.dart
index ff18071..1c8f375 100644
--- a/examples/layers/test/smoketests/raw/text_test.dart
+++ b/examples/layers/test/smoketests/raw/text_test.dart
@@ -2,8 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../raw/text.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/raw/touch_input_test.dart b/examples/layers/test/smoketests/raw/touch_input_test.dart
index 80597ec..d922afc 100644
--- a/examples/layers/test/smoketests/raw/touch_input_test.dart
+++ b/examples/layers/test/smoketests/raw/touch_input_test.dart
@@ -2,8 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../raw/touch_input.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/rendering/custom_coordinate_systems_test.dart b/examples/layers/test/smoketests/rendering/custom_coordinate_systems_test.dart
index baf93bb..deebc6a 100644
--- a/examples/layers/test/smoketests/rendering/custom_coordinate_systems_test.dart
+++ b/examples/layers/test/smoketests/rendering/custom_coordinate_systems_test.dart
@@ -4,8 +4,7 @@
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/scheduler.dart';
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../rendering/custom_coordinate_systems.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/rendering/flex_layout_test.dart b/examples/layers/test/smoketests/rendering/flex_layout_test.dart
index ebdb366..5f01f33 100644
--- a/examples/layers/test/smoketests/rendering/flex_layout_test.dart
+++ b/examples/layers/test/smoketests/rendering/flex_layout_test.dart
@@ -4,8 +4,7 @@
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/scheduler.dart';
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../rendering/flex_layout.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/rendering/hello_world_test.dart b/examples/layers/test/smoketests/rendering/hello_world_test.dart
index afd4799..746d451 100644
--- a/examples/layers/test/smoketests/rendering/hello_world_test.dart
+++ b/examples/layers/test/smoketests/rendering/hello_world_test.dart
@@ -4,8 +4,7 @@
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/scheduler.dart';
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../rendering/hello_world.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/rendering/spinning_square_test.dart b/examples/layers/test/smoketests/rendering/spinning_square_test.dart
index 6954d25..e8fe0e1 100644
--- a/examples/layers/test/smoketests/rendering/spinning_square_test.dart
+++ b/examples/layers/test/smoketests/rendering/spinning_square_test.dart
@@ -4,8 +4,7 @@
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/scheduler.dart';
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../rendering/spinning_square.dart' as demo;
 
diff --git a/examples/layers/test/smoketests/rendering/touch_input_test.dart b/examples/layers/test/smoketests/rendering/touch_input_test.dart
index 0ebb9dd..461c4b3 100644
--- a/examples/layers/test/smoketests/rendering/touch_input_test.dart
+++ b/examples/layers/test/smoketests/rendering/touch_input_test.dart
@@ -4,8 +4,7 @@
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/scheduler.dart';
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
+import 'package:flutter_test/flutter_test.dart' hide TypeMatcher, isInstanceOf;
 
 import '../../../rendering/touch_input.dart' as demo;
 
diff --git a/packages/flutter_driver/test/common.dart b/packages/flutter_driver/test/common.dart
index 6566fd8..48ace3c 100644
--- a/packages/flutter_driver/test/common.dart
+++ b/packages/flutter_driver/test/common.dart
@@ -5,10 +5,10 @@
 import 'dart:io';
 
 import 'package:flutter_driver/src/common/error.dart';
-import 'package:test_api/test_api.dart'; // ignore: deprecated_member_use
+import 'package:test/test.dart';
 
-export 'package:test_api/fake.dart'; // ignore: deprecated_member_use
-export 'package:test_api/test_api.dart'; // ignore: deprecated_member_use
+export 'package:test/fake.dart';
+export 'package:test/test.dart';
 
 void tryToDelete(Directory directory) {
   // This should not be necessary, but it turns out that
diff --git a/packages/flutter_test/lib/src/_goldens_io.dart b/packages/flutter_test/lib/src/_goldens_io.dart
index 81d410b..ad1cb29 100644
--- a/packages/flutter_test/lib/src/_goldens_io.dart
+++ b/packages/flutter_test/lib/src/_goldens_io.dart
@@ -8,8 +8,8 @@
 import 'dart:ui';
 
 import 'package:flutter/foundation.dart';
+import 'package:matcher/expect.dart' show fail;
 import 'package:path/path.dart' as path;
-import 'package:test_api/expect.dart' show fail;
 
 import 'goldens.dart';
 import 'test_async_utils.dart';
diff --git a/packages/flutter_test/lib/src/_goldens_web.dart b/packages/flutter_test/lib/src/_goldens_web.dart
index 2b9b2be..4053e4d 100644
--- a/packages/flutter_test/lib/src/_goldens_web.dart
+++ b/packages/flutter_test/lib/src/_goldens_web.dart
@@ -6,7 +6,7 @@
 import 'dart:html' as html;
 import 'dart:typed_data';
 
-import 'package:test_api/expect.dart' show fail;
+import 'package:matcher/expect.dart' show fail;
 
 import 'goldens.dart';
 
diff --git a/packages/flutter_test/lib/src/_matchers_io.dart b/packages/flutter_test/lib/src/_matchers_io.dart
index 702fdfa..ec678f6 100644
--- a/packages/flutter_test/lib/src/_matchers_io.dart
+++ b/packages/flutter_test/lib/src/_matchers_io.dart
@@ -7,8 +7,9 @@
 
 import 'package:flutter/rendering.dart';
 import 'package:flutter/widgets.dart';
-import 'package:test_api/src/expect/async_matcher.dart'; // ignore: implementation_imports
-import 'package:test_api/test_api.dart'; // ignore: deprecated_member_use
+import 'package:matcher/expect.dart';
+import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports
+import 'package:test_api/hooks.dart' show TestFailure;
 
 import 'binding.dart';
 import 'finders.dart';
diff --git a/packages/flutter_test/lib/src/_matchers_web.dart b/packages/flutter_test/lib/src/_matchers_web.dart
index 33740b7..71a78c3 100644
--- a/packages/flutter_test/lib/src/_matchers_web.dart
+++ b/packages/flutter_test/lib/src/_matchers_web.dart
@@ -6,8 +6,9 @@
 
 import 'package:flutter/rendering.dart';
 import 'package:flutter/widgets.dart';
-import 'package:test_api/src/expect/async_matcher.dart'; // ignore: implementation_imports
-import 'package:test_api/test_api.dart'; // ignore: deprecated_member_use
+import 'package:matcher/expect.dart';
+import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports
+import 'package:test_api/hooks.dart' show TestFailure;
 
 import 'binding.dart';
 import 'finders.dart';
diff --git a/packages/flutter_test/lib/src/buffer_matcher.dart b/packages/flutter_test/lib/src/buffer_matcher.dart
index 5701b60..1a2adab 100644
--- a/packages/flutter_test/lib/src/buffer_matcher.dart
+++ b/packages/flutter_test/lib/src/buffer_matcher.dart
@@ -4,7 +4,7 @@
 
 import 'dart:typed_data';
 
-import 'package:test_api/src/expect/async_matcher.dart'; // ignore: implementation_imports
+import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports
 // ignore: deprecated_member_use
 import 'package:test_api/test_api.dart' show Description, TestFailure;
 
diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart
index a9027ac..5c520b7 100644
--- a/packages/flutter_test/lib/src/matchers.dart
+++ b/packages/flutter_test/lib/src/matchers.dart
@@ -10,10 +10,8 @@
 import 'package:flutter/rendering.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter/widgets.dart';
-import 'package:test_api/src/expect/async_matcher.dart'; // ignore: implementation_imports
-// This import is discouraged in general, but we need it to implement flutter_test.
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart';
+import 'package:matcher/expect.dart';
+import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports
 
 import '_matchers_io.dart' if (dart.library.html) '_matchers_web.dart' show MatchesGoldenFile, captureImage;
 import 'accessibility.dart';
diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart
index fcd2472..b9bfe9c 100644
--- a/packages/flutter_test/lib/src/widget_tester.dart
+++ b/packages/flutter_test/lib/src/widget_tester.dart
@@ -9,6 +9,7 @@
 import 'package:flutter/rendering.dart';
 import 'package:flutter/scheduler.dart';
 import 'package:flutter/services.dart';
+import 'package:matcher/expect.dart' as matcher_expect;
 import 'package:meta/meta.dart';
 
 // The test_api package is not for general use... it's literally for our use.
@@ -28,7 +29,14 @@
 
 // Keep users from needing multiple imports to test semantics.
 export 'package:flutter/rendering.dart' show SemanticsHandle;
-
+// We re-export the matcher package minus some features that we reimplement.
+//
+//  - expect is reimplemented below, to catch incorrect async usage.
+//
+//  - isInstanceOf is reimplemented in matchers.dart because we don't want to
+//    mark it as deprecated (ours is just a method, not a class).
+//
+export 'package:matcher/expect.dart' hide expect, isInstanceOf;
 // We re-export the test package minus some features that we reimplement.
 //
 // Specifically:
@@ -38,23 +46,14 @@
 //    setting up a declarer when one is not defined, which can happen when a
 //    test is executed via `flutter run`.
 //
-//  - expect is reimplemented below, to catch incorrect async usage.
-//
-//  - isInstanceOf is reimplemented in matchers.dart because we don't want to
-//    mark it as deprecated (ours is just a method, not a class).
-//
 // The test_api package has a deprecation warning to discourage direct use but
 // that doesn't apply here.
+export 'package:test_api/hooks.dart' show TestFailure;
 // ignore: deprecated_member_use
-export 'package:test_api/test_api.dart' hide
-  expect,
-  group,
-  isInstanceOf,
-  setUp,
-  setUpAll,
-  tearDown,
-  tearDownAll,
-  test;
+export 'package:test_api/scaffolding.dart'
+    hide group, setUp, setUpAll, tearDown, tearDownAll, test;
+// ignore: implementation_imports
+export 'package:test_api/src/scaffolding/utils.dart' show registerException;
 
 /// Signature for callback to [testWidgets] and [benchmarkWidgets].
 typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
@@ -442,7 +441,7 @@
 
 /// Assert that `actual` matches `matcher`.
 ///
-/// See [test_package.expect] for details. This is a variant of that function
+/// See [matcher_expect.expect] for details. This is a variant of that function
 /// that additionally verifies that there are no asynchronous APIs
 /// that have not yet resolved.
 ///
@@ -456,12 +455,12 @@
   dynamic skip, // true or a String
 }) {
   TestAsyncUtils.guardSync();
-  test_package.expect(actual, matcher, reason: reason, skip: skip);
+  matcher_expect.expect(actual, matcher, reason: reason, skip: skip);
 }
 
 /// Assert that `actual` matches `matcher`.
 ///
-/// See [test_package.expect] for details. This variant will _not_ check that
+/// See [matcher_expect.expect] for details. This variant will _not_ check that
 /// there are no outstanding asynchronous API requests. As such, it can be
 /// called from, e.g., callbacks that are run during build or layout, or in the
 /// completion handlers of futures that execute in response to user input.
@@ -473,13 +472,13 @@
   dynamic matcher, {
   String? reason,
 }) {
-  test_package.expect(actual, matcher, reason: reason);
+  matcher_expect.expect(actual, matcher, reason: reason);
 }
 
 /// Just like [expect], but returns a [Future] that completes when the matcher
 /// has finished matching.
 ///
-/// See [test_package.expectLater] for details.
+/// See [matcher_expect.expectLater] for details.
 ///
 /// If the matcher fails asynchronously, that failure is piped to the returned
 /// future where it can be handled by user code. If it is not handled by user
@@ -493,7 +492,7 @@
   // We can't wrap the delegate in a guard, or we'll hit async barriers in
   // [TestWidgetsFlutterBinding] while we're waiting for the matcher to complete
   TestAsyncUtils.guardSync();
-  return test_package.expectLater(actual, matcher, reason: reason, skip: skip)
+  return matcher_expect.expectLater(actual, matcher, reason: reason, skip: skip)
            .then<void>((dynamic value) => null);
 }
 
diff --git a/packages/flutter_test/test/bindings_test.dart b/packages/flutter_test/test/bindings_test.dart
index d83abe4..ef4a165 100644
--- a/packages/flutter_test/test/bindings_test.dart
+++ b/packages/flutter_test/test/bindings_test.dart
@@ -16,9 +16,6 @@
 import 'package:flutter/widgets.dart';
 import 'package:flutter_test/flutter_test.dart';
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' as test_package;
-
 void main() {
   final AutomatedTestWidgetsFlutterBinding binding = AutomatedTestWidgetsFlutterBinding();
 
@@ -31,7 +28,7 @@
 
   group(AutomatedTestWidgetsFlutterBinding, () {
     test('allows setting defaultTestTimeout to 5 minutes', () {
-      binding.defaultTestTimeout = const test_package.Timeout(Duration(minutes: 5));
+      binding.defaultTestTimeout = const Timeout(Duration(minutes: 5));
       expect(binding.defaultTestTimeout.duration, const Duration(minutes: 5));
     });
   });
diff --git a/packages/flutter_test/test/test_async_utils_test.dart b/packages/flutter_test/test/test_async_utils_test.dart
index 1585823..9c64d42 100644
--- a/packages/flutter_test/test/test_async_utils_test.dart
+++ b/packages/flutter_test/test/test_async_utils_test.dart
@@ -7,10 +7,9 @@
 
 import 'package:flutter_test/flutter_test.dart' as flutter_test show expect;
 
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' as real_test show expect;
+import 'package:matcher/expect.dart' as matcher show expect;
 
-// We have to use real_test's expect because the flutter_test expect() goes
+// We have to use matcher's expect because the flutter_test expect() goes
 // out of its way to check that we're not leaking APIs and the whole point
 // of this test is to see how we handle leaking APIs.
 
@@ -49,14 +48,14 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Guarded function conflict.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], matches(r'The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.'));
-      real_test.expect(lines[3], matches(r'Then, the "testGuard2" method \(also from class TestAPI\) was called from .*test_async_utils_test.dart on line [0-9]+\.'));
-      real_test.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second method (TestAPI.testGuard2) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
-      real_test.expect(lines[5], '');
-      real_test.expect(lines[6], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
-      real_test.expect(lines.length, greaterThan(6));
+      matcher.expect(lines[0], 'Guarded function conflict.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], matches(r'The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.'));
+      matcher.expect(lines[3], matches(r'Then, the "testGuard2" method \(also from class TestAPI\) was called from .*test_async_utils_test.dart on line [0-9]+\.'));
+      matcher.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second method (TestAPI.testGuard2) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
+      matcher.expect(lines[5], '');
+      matcher.expect(lines[6], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
+      matcher.expect(lines.length, greaterThan(6));
     }
     expect(await f1, isNull);
     expect(f2, isNull);
@@ -71,14 +70,14 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Guarded function conflict.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[3], matches(r'^Then, the "testGuard2" method \(also from class TestAPI\) was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second method (TestAPI.testGuard2) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
-      real_test.expect(lines[5], '');
-      real_test.expect(lines[6], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
-      real_test.expect(lines.length, greaterThan(7));
+      matcher.expect(lines[0], 'Guarded function conflict.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[3], matches(r'^Then, the "testGuard2" method \(also from class TestAPI\) was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second method (TestAPI.testGuard2) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
+      matcher.expect(lines[5], '');
+      matcher.expect(lines[6], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
+      matcher.expect(lines.length, greaterThan(7));
     }
     expect(await f1, isNull);
     expect(f2, isNull);
@@ -93,14 +92,14 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Guarded function conflict.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[3], matches(r'^Then, the "testGuard3" method from class TestAPISubclass was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second method (TestAPISubclass.testGuard3) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
-      real_test.expect(lines[5], '');
-      real_test.expect(lines[6], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
-      real_test.expect(lines.length, greaterThan(7));
+      matcher.expect(lines[0], 'Guarded function conflict.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[3], matches(r'^Then, the "testGuard3" method from class TestAPISubclass was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second method (TestAPISubclass.testGuard3) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
+      matcher.expect(lines[5], '');
+      matcher.expect(lines[6], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
+      matcher.expect(lines.length, greaterThan(7));
     }
     expect(await f1, isNull);
     expect(f2, isNull);
@@ -115,15 +114,15 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Guarded function conflict.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[3], matches(r'^Then, the "expect" function was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second function (expect) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
-      real_test.expect(lines[5], 'If you are confident that all test APIs are being called using "await", and this expect() call is not being called at the top level but is itself being called from some sort of callback registered before the testGuard1 method was called, then consider using expectSync() instead.');
-      real_test.expect(lines[6], '');
-      real_test.expect(lines[7], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
-      real_test.expect(lines.length, greaterThan(7));
+      matcher.expect(lines[0], 'Guarded function conflict.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[3], matches(r'^Then, the "expect" function was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[4], 'The first method (TestAPI.testGuard1) had not yet finished executing at the time that the second function (expect) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
+      matcher.expect(lines[5], 'If you are confident that all test APIs are being called using "await", and this expect() call is not being called at the top level but is itself being called from some sort of callback registered before the testGuard1 method was called, then consider using expectSync() instead.');
+      matcher.expect(lines[6], '');
+      matcher.expect(lines[7], 'When the first method (TestAPI.testGuard1) was called, this was the stack:');
+      matcher.expect(lines.length, greaterThan(7));
     }
     expect(await f1, isNull);
   }, skip: kIsWeb); // [intended] depends on platform-specific stack traces.
@@ -136,35 +135,35 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Guarded function conflict.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[3], matches(r'^Then, it was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
-      real_test.expect(lines[4], 'The first method had not yet finished executing at the time that the second method was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
-      real_test.expect(lines[5], '');
-      real_test.expect(lines[6], 'When the first method was called, this was the stack:');
-      real_test.expect(lines.length, greaterThan(7));
+      matcher.expect(lines[0], 'Guarded function conflict.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[3], matches(r'^Then, it was called from .*test_async_utils_test.dart on line [0-9]+\.$'));
+      matcher.expect(lines[4], 'The first method had not yet finished executing at the time that the second method was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.');
+      matcher.expect(lines[5], '');
+      matcher.expect(lines[6], 'When the first method was called, this was the stack:');
+      matcher.expect(lines.length, greaterThan(7));
       // TODO(jacobr): add more tests like this if they are useful.
 
       final DiagnosticPropertiesBuilder propertiesBuilder = DiagnosticPropertiesBuilder();
       e.debugFillProperties(propertiesBuilder);
       final List<DiagnosticsNode> information = propertiesBuilder.properties;
-      real_test.expect(information.length, 6);
-      real_test.expect(information[0].level, DiagnosticLevel.summary);
-      real_test.expect(information[1].level, DiagnosticLevel.hint);
-      real_test.expect(information[2].level, DiagnosticLevel.info);
-      real_test.expect(information[3].level, DiagnosticLevel.info);
-      real_test.expect(information[4].level, DiagnosticLevel.info);
-      real_test.expect(information[5].level, DiagnosticLevel.info);
-      real_test.expect(information[0], isA<DiagnosticsProperty<void>>());
-      real_test.expect(information[1], isA<DiagnosticsProperty<void>>());
-      real_test.expect(information[2], isA<DiagnosticsProperty<void>>());
-      real_test.expect(information[3], isA<DiagnosticsProperty<void>>());
-      real_test.expect(information[4], isA<DiagnosticsProperty<void>>());
-      real_test.expect(information[5], isA<DiagnosticsStackTrace>());
+      matcher.expect(information.length, 6);
+      matcher.expect(information[0].level, DiagnosticLevel.summary);
+      matcher.expect(information[1].level, DiagnosticLevel.hint);
+      matcher.expect(information[2].level, DiagnosticLevel.info);
+      matcher.expect(information[3].level, DiagnosticLevel.info);
+      matcher.expect(information[4].level, DiagnosticLevel.info);
+      matcher.expect(information[5].level, DiagnosticLevel.info);
+      matcher.expect(information[0], isA<DiagnosticsProperty<void>>());
+      matcher.expect(information[1], isA<DiagnosticsProperty<void>>());
+      matcher.expect(information[2], isA<DiagnosticsProperty<void>>());
+      matcher.expect(information[3], isA<DiagnosticsProperty<void>>());
+      matcher.expect(information[4], isA<DiagnosticsProperty<void>>());
+      matcher.expect(information[5], isA<DiagnosticsStackTrace>());
       final DiagnosticsStackTrace stackTraceProperty = information[5] as DiagnosticsStackTrace;
-      real_test.expect(stackTraceProperty.name, '\nWhen the first method was called, this was the stack');
-      real_test.expect(stackTraceProperty.value, isA<StackTrace>());
+      matcher.expect(stackTraceProperty.name, '\nWhen the first method was called, this was the stack');
+      matcher.expect(stackTraceProperty.value, isA<StackTrace>());
     }
     await f1;
     await f2;
@@ -178,19 +177,19 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Asynchronous call to guarded function leaked.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+, but never completed before its parent scope closed\.$'));
-      real_test.expect(lines[3], matches(r'^The guarded method "pump" from class AutomatedTestWidgetsFlutterBinding was called from [^ ]+ on line [0-9]+, but never completed before its parent scope closed\.'));
-      real_test.expect(lines.length, 4);
+      matcher.expect(lines[0], 'Asynchronous call to guarded function leaked.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+, but never completed before its parent scope closed\.$'));
+      matcher.expect(lines[3], matches(r'^The guarded method "pump" from class AutomatedTestWidgetsFlutterBinding was called from [^ ]+ on line [0-9]+, but never completed before its parent scope closed\.'));
+      matcher.expect(lines.length, 4);
       final DiagnosticPropertiesBuilder propertiesBuilder = DiagnosticPropertiesBuilder();
       e.debugFillProperties(propertiesBuilder);
       final List<DiagnosticsNode> information = propertiesBuilder.properties;
-      real_test.expect(information.length, 4);
-      real_test.expect(information[0].level, DiagnosticLevel.summary);
-      real_test.expect(information[1].level, DiagnosticLevel.hint);
-      real_test.expect(information[2].level, DiagnosticLevel.info);
-      real_test.expect(information[3].level, DiagnosticLevel.info);
+      matcher.expect(information.length, 4);
+      matcher.expect(information[0].level, DiagnosticLevel.summary);
+      matcher.expect(information[1].level, DiagnosticLevel.hint);
+      matcher.expect(information[2].level, DiagnosticLevel.info);
+      matcher.expect(information[3].level, DiagnosticLevel.info);
     }
     await f1;
   }, skip: kIsWeb); // [intended] depends on platform-specific stack traces.
@@ -203,19 +202,19 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Asynchronous call to guarded function leaked.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+, but never completed before its parent scope closed\.$'));
-      real_test.expect(lines[3], matches(r'^The guarded method "pump" from class AutomatedTestWidgetsFlutterBinding was called from [^ ]+ on line [0-9]+, but never completed before its parent scope closed\.'));
-      real_test.expect(lines.length, 4);
+      matcher.expect(lines[0], 'Asynchronous call to guarded function leaked.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+, but never completed before its parent scope closed\.$'));
+      matcher.expect(lines[3], matches(r'^The guarded method "pump" from class AutomatedTestWidgetsFlutterBinding was called from [^ ]+ on line [0-9]+, but never completed before its parent scope closed\.'));
+      matcher.expect(lines.length, 4);
       final DiagnosticPropertiesBuilder propertiesBuilder = DiagnosticPropertiesBuilder();
       e.debugFillProperties(propertiesBuilder);
       final List<DiagnosticsNode> information = propertiesBuilder.properties;
-      real_test.expect(information.length, 4);
-      real_test.expect(information[0].level, DiagnosticLevel.summary);
-      real_test.expect(information[1].level, DiagnosticLevel.hint);
-      real_test.expect(information[2].level, DiagnosticLevel.info);
-      real_test.expect(information[3].level, DiagnosticLevel.info);
+      matcher.expect(information.length, 4);
+      matcher.expect(information[0].level, DiagnosticLevel.summary);
+      matcher.expect(information[1].level, DiagnosticLevel.hint);
+      matcher.expect(information[2].level, DiagnosticLevel.info);
+      matcher.expect(information[3].level, DiagnosticLevel.info);
     }
     await f1;
   }, skip: kIsWeb); // [intended] depends on platform-specific stack traces.
@@ -238,11 +237,11 @@
       fail('unexpectedly did not throw');
     } on FlutterError catch (e) {
       final List<String> lines = e.message.split('\n');
-      real_test.expect(lines[0], 'Guarded function conflict.');
-      real_test.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
-      real_test.expect(lines[2], '');
-      real_test.expect(lines[3], 'When the first function was called, this was the stack:');
-      real_test.expect(lines.length, greaterThan(3));
+      matcher.expect(lines[0], 'Guarded function conflict.');
+      matcher.expect(lines[1], 'You must use "await" with all Future-returning test APIs.');
+      matcher.expect(lines[2], '');
+      matcher.expect(lines[3], 'When the first function was called, this was the stack:');
+      matcher.expect(lines.length, greaterThan(3));
     }
     expect(await f1, isNull);
     expect(f2, isNull);
diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart
index 32a256c..153aed0 100644
--- a/packages/flutter_test/test/widget_tester_test.dart
+++ b/packages/flutter_test/test/widget_tester_test.dart
@@ -13,9 +13,8 @@
 import 'package:flutter/scheduler.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
-import 'package:test_api/src/expect/async_matcher.dart'; // ignore: implementation_imports
-// ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' as test_package;
+import 'package:matcher/expect.dart' as matcher;
+import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports
 
 const List<Widget> fooBarTexts = <Text>[
   Text('foo', textDirection: TextDirection.ltr),
@@ -31,12 +30,12 @@
       future.then<void>((void value) {
         result = '123';
       });
-      test_package.expect(result, isNull);
+      matcher.expect(result, isNull);
       completer.complete();
-      test_package.expect(result, isNull);
+      matcher.expect(result, isNull);
       await future;
       await tester.pump();
-      test_package.expect(result, '123');
+      matcher.expect(result, '123');
     });
 
     testWidgets('respects the skip flag', (WidgetTester tester) async {
@@ -46,9 +45,9 @@
       future.then<void>((_) {
         completed = true;
       });
-      test_package.expect(completed, isFalse);
+      matcher.expect(completed, isFalse);
       await future;
-      test_package.expect(completed, isTrue);
+      matcher.expect(completed, isTrue);
     });
   });
 
diff --git a/packages/flutter_tools/test/src/common.dart b/packages/flutter_tools/test/src/common.dart
index b2b3d7b..68f9ec1 100644
--- a/packages/flutter_tools/test/src/common.dart
+++ b/packages/flutter_tools/test/src/common.dart
@@ -14,10 +14,10 @@
 import 'package:flutter_tools/src/globals.dart' as globals;
 import 'package:meta/meta.dart';
 import 'package:path/path.dart' as path; // flutter_ignore: package_path_import
-import 'package:test_api/test_api.dart' as test_package show test; // ignore: deprecated_member_use
-import 'package:test_api/test_api.dart' hide test; // ignore: deprecated_member_use
+import 'package:test/test.dart' as test_package show test;
+import 'package:test/test.dart' hide test;
 
-export 'package:test_api/test_api.dart' hide isInstanceOf, test; // ignore: deprecated_member_use
+export 'package:test/test.dart' hide isInstanceOf, test;
 
 void tryToDelete(FileSystemEntity fileEntity) {
   // This should not be necessary, but it turns out that
diff --git a/packages/flutter_tools/test/src/fake_vm_services.dart b/packages/flutter_tools/test/src/fake_vm_services.dart
index 1d978e5..e08f207 100644
--- a/packages/flutter_tools/test/src/fake_vm_services.dart
+++ b/packages/flutter_tools/test/src/fake_vm_services.dart
@@ -6,10 +6,10 @@
 
 import 'package:flutter_tools/src/convert.dart';
 import 'package:flutter_tools/src/vmservice.dart';
-import 'package:test_api/test_api.dart' hide test; // ignore: deprecated_member_use
+import 'package:test/test.dart' hide test;
 import 'package:vm_service/vm_service.dart' as vm_service;
 
-export 'package:test_api/test_api.dart' hide isInstanceOf, test; // ignore: deprecated_member_use
+export 'package:test/test.dart' hide isInstanceOf, test;
 
 /// A fake implementation of a vm_service that mocks the JSON-RPC request
 /// and response structure.
diff --git a/packages/flutter_tools/test/src/test_flutter_command_runner.dart b/packages/flutter_tools/test/src/test_flutter_command_runner.dart
index d616bbd..a29274f 100644
--- a/packages/flutter_tools/test/src/test_flutter_command_runner.dart
+++ b/packages/flutter_tools/test/src/test_flutter_command_runner.dart
@@ -16,7 +16,7 @@
 import 'package:flutter_tools/src/runner/flutter_command.dart';
 import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
 
-export 'package:test_api/test_api.dart' hide isInstanceOf, test; // ignore: deprecated_member_use
+export 'package:test/test.dart' hide isInstanceOf, test;
 
 CommandRunner<void> createTestCommandRunner([ FlutterCommand? command ]) {
   final FlutterCommandRunner runner = TestFlutterCommandRunner();