prefer_void_to_null in flutter_test (#22847)

* prefer_void_to_null in flutter_test

* fix CI
diff --git a/packages/flutter/test/cupertino/slider_test.dart b/packages/flutter/test/cupertino/slider_test.dart
index eae21e7..8959324 100644
--- a/packages/flutter/test/cupertino/slider_test.dart
+++ b/packages/flutter/test/cupertino/slider_test.dart
@@ -12,7 +12,7 @@
 
 void main() {
 
-  Future<Null> _dragSlider(WidgetTester tester, Key sliderKey) {
+  Future<void> _dragSlider(WidgetTester tester, Key sliderKey) {
     final Offset topLeft = tester.getTopLeft(find.byKey(sliderKey));
     const double unit = CupertinoThumbPainter.radius;
     const double delta = 3.0 * unit;
diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart
index fa906fc..8870443 100644
--- a/packages/flutter/test/material/chip_test.dart
+++ b/packages/flutter/test/material/chip_test.dart
@@ -545,7 +545,7 @@
 
   testWidgets('Avatar drawer works as expected on RawChip', (WidgetTester tester) async {
     final GlobalKey labelKey = GlobalKey();
-    Future<Null> pushChip({Widget avatar}) async {
+    Future<void> pushChip({Widget avatar}) async {
       return tester.pumpWidget(
         _wrapForChip(
           child: Wrap(
@@ -659,7 +659,7 @@
     final UniqueKey labelKey = UniqueKey();
     final UniqueKey deleteButtonKey = UniqueKey();
     bool wasDeleted = false;
-    Future<Null> pushChip({bool deletable = false}) async {
+    Future<void> pushChip({bool deletable = false}) async {
       return tester.pumpWidget(
         _wrapForChip(
           child: Wrap(
@@ -774,7 +774,7 @@
   testWidgets('Selection with avatar works as expected on RawChip', (WidgetTester tester) async {
     bool selected = false;
     final UniqueKey labelKey = UniqueKey();
-    Future<Null> pushChip({Widget avatar, bool selectable = false}) async {
+    Future<void> pushChip({Widget avatar, bool selectable = false}) async {
       return tester.pumpWidget(
         _wrapForChip(
           child: Wrap(
@@ -857,7 +857,7 @@
   testWidgets('Selection without avatar works as expected on RawChip', (WidgetTester tester) async {
     bool selected = false;
     final UniqueKey labelKey = UniqueKey();
-    Future<Null> pushChip({bool selectable = false}) async {
+    Future<void> pushChip({bool selectable = false}) async {
       return tester.pumpWidget(
         _wrapForChip(
           child: Wrap(
@@ -933,7 +933,7 @@
   testWidgets('Activation works as expected on RawChip', (WidgetTester tester) async {
     bool selected = false;
     final UniqueKey labelKey = UniqueKey();
-    Future<Null> pushChip({Widget avatar, bool selectable = false}) async {
+    Future<void> pushChip({Widget avatar, bool selectable = false}) async {
       return tester.pumpWidget(
         _wrapForChip(
           child: Wrap(
diff --git a/packages/flutter/test/rendering/viewport_test.dart b/packages/flutter/test/rendering/viewport_test.dart
index c97bbe8..a181101 100644
--- a/packages/flutter/test/rendering/viewport_test.dart
+++ b/packages/flutter/test/rendering/viewport_test.dart
@@ -353,7 +353,7 @@
   group('Nested viewports (same orientation) showOnScreen', () {
     List<Widget> children;
 
-    Future<Null> buildNestedScroller({WidgetTester tester, ScrollController inner, ScrollController outer}) {
+    Future<void> buildNestedScroller({WidgetTester tester, ScrollController inner, ScrollController outer}) {
       return tester.pumpWidget(
         Directionality(
           textDirection: TextDirection.ltr,
diff --git a/packages/flutter/test/widgets/animated_switcher_test.dart b/packages/flutter/test/widgets/animated_switcher_test.dart
index ae5a806..78c2a45 100644
--- a/packages/flutter/test/widgets/animated_switcher_test.dart
+++ b/packages/flutter/test/widgets/animated_switcher_test.dart
@@ -346,7 +346,7 @@
   });
 
   testWidgets('AnimatedSwitcher updates widgets without animating if they are isomorphic.', (WidgetTester tester) async {
-    Future<Null> pumpChild(Widget child) async {
+    Future<void> pumpChild(Widget child) async {
       return tester.pumpWidget(
         Directionality(
           textDirection: TextDirection.rtl,
diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart
index 2dba2fe..31f7d7d 100644
--- a/packages/flutter/test/widgets/editable_text_test.dart
+++ b/packages/flutter/test/widgets/editable_text_test.dart
@@ -1444,7 +1444,7 @@
   });
 
   group('a11y copy/cut/paste', () {
-    Future<Null> _buildApp(
+    Future<void> _buildApp(
         MockTextSelectionControls controls, WidgetTester tester) {
       return tester.pumpWidget(MaterialApp(
         home: EditableText(
diff --git a/packages/flutter/test/widgets/gesture_detector_test.dart b/packages/flutter/test/widgets/gesture_detector_test.dart
index a0b7820..67a0652 100644
--- a/packages/flutter/test/widgets/gesture_detector_test.dart
+++ b/packages/flutter/test/widgets/gesture_detector_test.dart
@@ -126,7 +126,7 @@
     bool didReceivePointerDown;
     bool didTap;
 
-    Future<Null> pumpWidgetTree(HitTestBehavior behavior) {
+    Future<void> pumpWidgetTree(HitTestBehavior behavior) {
       return tester.pumpWidget(
         Directionality(
           textDirection: TextDirection.ltr,
diff --git a/packages/flutter/test/widgets/image_resolution_test.dart b/packages/flutter/test/widgets/image_resolution_test.dart
index 84f1950..40ee82f 100644
--- a/packages/flutter/test/widgets/image_resolution_test.dart
+++ b/packages/flutter/test/widgets/image_resolution_test.dart
@@ -156,7 +156,7 @@
   return tester.renderObject<RenderImage>(find.byKey(key)).image;
 }
 
-Future<Null> pumpTreeToLayout(WidgetTester tester, Widget widget) {
+Future<void> pumpTreeToLayout(WidgetTester tester, Widget widget) {
   const Duration pumpDuration = Duration(milliseconds: 0);
   const EnginePhase pumpPhase = EnginePhase.layout;
   return tester.pumpWidget(widget, pumpDuration, pumpPhase);
diff --git a/packages/flutter/test/widgets/single_child_scroll_view_test.dart b/packages/flutter/test/widgets/single_child_scroll_view_test.dart
index d974141..4026b6a 100644
--- a/packages/flutter/test/widgets/single_child_scroll_view_test.dart
+++ b/packages/flutter/test/widgets/single_child_scroll_view_test.dart
@@ -697,7 +697,7 @@
   group('Nested SingleChildScrollView (same orientation) showOnScreen', () {
     List<Widget> children;
 
-    Future<Null> buildNestedScroller({WidgetTester tester, ScrollController inner, ScrollController outer}) {
+    Future<void> buildNestedScroller({WidgetTester tester, ScrollController inner, ScrollController outer}) {
       return tester.pumpWidget(
         Directionality(
           textDirection: TextDirection.ltr,
diff --git a/packages/flutter/test/widgets/slivers_block_global_key_test.dart b/packages/flutter/test/widgets/slivers_block_global_key_test.dart
index 2aa787d..ebfc534 100644
--- a/packages/flutter/test/widgets/slivers_block_global_key_test.dart
+++ b/packages/flutter/test/widgets/slivers_block_global_key_test.dart
@@ -24,7 +24,7 @@
 
 // Creates a SliverList with `keys.length` children and each child having a key from `keys` and a text of `key:generation`.
 // The generation is increased with every call to this method.
-Future<Null> test(WidgetTester tester, double offset, List<int> keys) {
+Future<void> test(WidgetTester tester, double offset, List<int> keys) {
   globalGeneration += 1;
   return tester.pumpWidget(
     Directionality(
diff --git a/packages/flutter/test/widgets/slivers_block_test.dart b/packages/flutter/test/widgets/slivers_block_test.dart
index d433be9..147b25b 100644
--- a/packages/flutter/test/widgets/slivers_block_test.dart
+++ b/packages/flutter/test/widgets/slivers_block_test.dart
@@ -8,7 +8,7 @@
 
 import '../rendering/mock_canvas.dart';
 
-Future<Null> test(WidgetTester tester, double offset) {
+Future<void> test(WidgetTester tester, double offset) {
   return tester.pumpWidget(
     Directionality(
       textDirection: TextDirection.ltr,
diff --git a/packages/flutter/test/widgets/slivers_padding_test.dart b/packages/flutter/test/widgets/slivers_padding_test.dart
index 2316111..89ad950 100644
--- a/packages/flutter/test/widgets/slivers_padding_test.dart
+++ b/packages/flutter/test/widgets/slivers_padding_test.dart
@@ -6,7 +6,7 @@
 import 'package:flutter/rendering.dart';
 import 'package:flutter/widgets.dart';
 
-Future<Null> test(WidgetTester tester, double offset, EdgeInsetsGeometry padding, AxisDirection axisDirection, TextDirection textDirection) {
+Future<void> test(WidgetTester tester, double offset, EdgeInsetsGeometry padding, AxisDirection axisDirection, TextDirection textDirection) {
   return tester.pumpWidget(
     Directionality(
       textDirection: textDirection,
diff --git a/packages/flutter/test/widgets/slivers_test.dart b/packages/flutter/test/widgets/slivers_test.dart
index 9b39ac7..c25ee66 100644
--- a/packages/flutter/test/widgets/slivers_test.dart
+++ b/packages/flutter/test/widgets/slivers_test.dart
@@ -6,7 +6,7 @@
 import 'package:flutter/widgets.dart';
 import 'package:flutter/rendering.dart';
 
-Future<Null> test(WidgetTester tester, double offset, { double anchor = 0.0 }) {
+Future<void> test(WidgetTester tester, double offset, { double anchor = 0.0 }) {
   return tester.pumpWidget(
     Directionality(
       textDirection: TextDirection.ltr,
diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart
index 80c3fb8..b865b0b 100644
--- a/packages/flutter_test/lib/src/binding.dart
+++ b/packages/flutter_test/lib/src/binding.dart
@@ -197,7 +197,7 @@
   ///
   /// See also [LiveTestWidgetsFlutterBindingFramePolicy], which affects how
   /// this method works when the test is run with `flutter run`.
-  Future<Null> pump([ Duration duration, EnginePhase newPhase = EnginePhase.sendSemanticsUpdate ]);
+  Future<void> pump([ Duration duration, EnginePhase newPhase = EnginePhase.sendSemanticsUpdate ]);
 
   /// Runs a `callback` that performs real asynchronous work.
   ///
@@ -227,12 +227,11 @@
 
   /// Artificially calls dispatchLocaleChanged on the Widget binding,
   /// then flushes microtasks.
-  Future<Null> setLocale(String languageCode, String countryCode) {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> setLocale(String languageCode, String countryCode) {
+    return TestAsyncUtils.guard<void>(() async {
       assert(inTest);
       final Locale locale = Locale(languageCode, countryCode);
       dispatchLocaleChanged(locale);
-      return null;
     });
   }
 
@@ -242,14 +241,13 @@
   /// then flushes microtasks.
   ///
   /// Set to null to use the default surface size.
-  Future<Null> setSurfaceSize(Size size) {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> setSurfaceSize(Size size) {
+    return TestAsyncUtils.guard<void>(() async {
       assert(inTest);
       if (_surfaceSize == size)
-        return null;
+        return;
       _surfaceSize = size;
       handleMetricsChanged();
-      return null;
     });
   }
 
@@ -272,11 +270,11 @@
   /// May result in an infinite loop or run out of memory if microtasks continue
   /// to recursively schedule new microtasks. Will not run any timers scheduled
   /// after this method was invoked, even if they are zero-time timers.
-  Future<Null> idle() {
-    return TestAsyncUtils.guard<Null>(() {
-      final Completer<Null> completer = Completer<Null>();
+  Future<void> idle() {
+    return TestAsyncUtils.guard<void>(() {
+      final Completer<void> completer = Completer<void>();
       Timer.run(() {
-        completer.complete(null);
+        completer.complete();
       });
       return completer.future;
     });
@@ -386,7 +384,7 @@
   /// The `description` is used by the [LiveTestWidgetsFlutterBinding] to
   /// show a label on the screen during the test. The description comes from
   /// the value passed to [testWidgets]. It must not be null.
-  Future<Null> runTest(Future<Null> testBody(), VoidCallback invariantTester, { String description = '' });
+  Future<void> runTest(Future<void> testBody(), VoidCallback invariantTester, { String description = '' });
 
   /// This is called during test execution before and after the body has been
   /// executed.
@@ -399,7 +397,7 @@
 
   Zone _parentZone;
 
-  VoidCallback _createTestCompletionHandler(String testDescription, Completer<Null> completer) {
+  VoidCallback _createTestCompletionHandler(String testDescription, Completer<void> completer) {
     return () {
       // This can get called twice, in the case of a Future without listeners failing, and then
       // our main future completing.
@@ -410,7 +408,7 @@
         _pendingExceptionDetails = null;
       }
       if (!completer.isCompleted)
-        completer.complete(null);
+        completer.complete();
     };
   }
 
@@ -426,8 +424,8 @@
     // The LiveTestWidgetsFlutterBinding overrides this to report the exception to the console.
   }
 
-  Future<Null> _runTest(Future<Null> testBody(), VoidCallback invariantTester, String description, {
-    Future<Null> timeout,
+  Future<void> _runTest(Future<void> testBody(), VoidCallback invariantTester, String description, {
+    Future<void> timeout,
   }) {
     assert(description != null);
     assert(inTest);
@@ -452,7 +450,7 @@
         _pendingExceptionDetails = details;
       }
     };
-    final Completer<Null> testCompleter = Completer<Null>();
+    final Completer<void> testCompleter = Completer<void>();
     final VoidCallback testCompletionHandler = _createTestCompletionHandler(description, testCompleter);
     void handleUncaughtError(dynamic exception, StackTrace stack) {
       if (testCompleter.isCompleted) {
@@ -537,13 +535,13 @@
     );
     _parentZone = Zone.current;
     final Zone testZone = _parentZone.fork(specification: errorHandlingZoneSpecification);
-    testZone.runBinary<Future<Null>, Future<Null> Function(), VoidCallback>(_runTestBody, testBody, invariantTester)
+    testZone.runBinary<Future<void>, Future<void> Function(), VoidCallback>(_runTestBody, testBody, invariantTester)
       .whenComplete(testCompletionHandler);
     timeout?.catchError(handleUncaughtError);
     return testCompleter.future;
   }
 
-  Future<Null> _runTestBody(Future<Null> testBody(), VoidCallback invariantTester) async {
+  Future<void> _runTestBody(Future<void> testBody(), VoidCallback invariantTester) async {
     assert(inTest);
 
     runApp(Container(key: UniqueKey(), child: _preTestMessage)); // Reset the tree to a known state.
@@ -688,8 +686,8 @@
   int get microtaskCount => _currentFakeAsync.microtaskCount;
 
   @override
-  Future<Null> pump([ Duration duration, EnginePhase newPhase = EnginePhase.sendSemanticsUpdate ]) {
-    return TestAsyncUtils.guard<Null>(() {
+  Future<void> pump([ Duration duration, EnginePhase newPhase = EnginePhase.sendSemanticsUpdate ]) {
+    return TestAsyncUtils.guard<void>(() {
       assert(inTest);
       assert(_clock != null);
       if (duration != null)
@@ -705,7 +703,7 @@
         handleDrawFrame();
       }
       _currentFakeAsync.flushMicrotasks();
-      return Future<Null>.value();
+      return Future<void>.value();
     });
   }
 
@@ -774,8 +772,8 @@
   }
 
   @override
-  Future<Null> idle() {
-    final Future<Null> result = super.idle();
+  Future<void> idle() {
+    final Future<void> result = super.idle();
     _currentFakeAsync.elapse(const Duration());
     return result;
   }
@@ -816,7 +814,7 @@
   Duration _timeout;
   Stopwatch _timeoutStopwatch;
   Timer _timeoutTimer;
-  Completer<Null> _timeoutCompleter;
+  Completer<void> _timeoutCompleter;
 
   void _checkTimeout(Timer timer) {
     assert(_timeoutTimer == timer);
@@ -860,7 +858,7 @@
   }
 
   @override
-  Future<Null> runTest(Future<Null> testBody(), VoidCallback invariantTester, {
+  Future<void> runTest(Future<void> testBody(), VoidCallback invariantTester, {
     String description = '',
     Duration timeout = const Duration(seconds: 2),
   }) {
@@ -872,12 +870,12 @@
     _timeout = timeout;
     _timeoutStopwatch = Stopwatch()..start();
     _timeoutTimer = Timer.periodic(const Duration(seconds: 1), _checkTimeout);
-    _timeoutCompleter = Completer<Null>();
+    _timeoutCompleter = Completer<void>();
 
     final FakeAsync fakeAsync = FakeAsync();
     _currentFakeAsync = fakeAsync; // reset in postTest
     _clock = fakeAsync.getClock(DateTime.utc(2015, 1, 1));
-    Future<Null> testBodyResult;
+    Future<void> testBodyResult;
     fakeAsync.run((FakeAsync localFakeAsync) {
       assert(fakeAsync == _currentFakeAsync);
       assert(fakeAsync == localFakeAsync);
@@ -885,14 +883,14 @@
       assert(inTest);
     });
 
-    return Future<Null>.microtask(() async {
+    return Future<void>.microtask(() async {
       // testBodyResult is a Future that was created in the Zone of the
       // fakeAsync. This means that if we await it here, it will register a
       // microtask to handle the future _in the fake async zone_. We avoid this
       // by calling '.then' in the current zone. While flushing the microtasks
       // of the fake-zone below, the new future will be completed and can then
       // be used without fakeAsync.
-      final Future<Null> resultFuture = testBodyResult.then<Null>((_) {
+      final Future<void> resultFuture = testBodyResult.then<void>((_) {
         // Do nothing.
       });
 
@@ -1038,7 +1036,7 @@
   @override
   test_package.Timeout get defaultTestTimeout => test_package.Timeout.none;
 
-  Completer<Null> _pendingFrame;
+  Completer<void> _pendingFrame;
   bool _expectingFrame = false;
   bool _viewNeedsPaint = false;
   bool _runningAsyncTasks = false;
@@ -1192,12 +1190,12 @@
   }
 
   @override
-  Future<Null> pump([ Duration duration, EnginePhase newPhase = EnginePhase.sendSemanticsUpdate ]) {
+  Future<void> pump([ Duration duration, EnginePhase newPhase = EnginePhase.sendSemanticsUpdate ]) {
     assert(newPhase == EnginePhase.sendSemanticsUpdate);
     assert(inTest);
     assert(!_expectingFrame);
     assert(_pendingFrame == null);
-    return TestAsyncUtils.guard<Null>(() {
+    return TestAsyncUtils.guard<void>(() {
       if (duration != null) {
         Timer(duration, () {
           _expectingFrame = true;
@@ -1207,7 +1205,7 @@
         _expectingFrame = true;
         scheduleFrame();
       }
-      _pendingFrame = Completer<Null>();
+      _pendingFrame = Completer<void>();
       return _pendingFrame.future;
     });
   }
@@ -1244,7 +1242,7 @@
   }
 
   @override
-  Future<Null> runTest(Future<Null> testBody(), VoidCallback invariantTester, { String description = '' }) async {
+  Future<void> runTest(Future<void> testBody(), VoidCallback invariantTester, { String description = '' }) async {
     assert(description != null);
     assert(!inTest);
     _inTest = true;
@@ -1587,8 +1585,8 @@
   void addError(Object error, [StackTrace stackTrace]) {}
 
   @override
-  Future<Null> addStream(Stream<List<int>> stream) {
-    return Future<Null>.value(null);
+  Future<void> addStream(Stream<List<int>> stream) {
+    return Future<void>.value();
   }
 
   @override
@@ -1606,8 +1604,8 @@
   Future<HttpClientResponse> get done => null;
 
   @override
-  Future<Null> flush() {
-    return Future<Null>.value(null);
+  Future<void> flush() {
+    return Future<void>.value();
   }
 
   @override
diff --git a/packages/flutter_test/lib/src/controller.dart b/packages/flutter_test/lib/src/controller.dart
index 0d70e84..7f7defc 100644
--- a/packages/flutter_test/lib/src/controller.dart
+++ b/packages/flutter_test/lib/src/controller.dart
@@ -256,16 +256,15 @@
   ///
   /// If the center of the widget is not exposed, this might send events to
   /// another object.
-  Future<Null> tap(Finder finder, { int pointer }) {
+  Future<void> tap(Finder finder, { int pointer }) {
     return tapAt(getCenter(finder), pointer: pointer);
   }
 
   /// Dispatch a pointer down / pointer up sequence at the given location.
-  Future<Null> tapAt(Offset location, { int pointer }) {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> tapAt(Offset location, { int pointer }) {
+    return TestAsyncUtils.guard<void>(() async {
       final TestGesture gesture = await startGesture(location, pointer: pointer);
       await gesture.up();
-      return null;
     });
   }
 
@@ -286,18 +285,17 @@
   ///
   /// If the center of the widget is not exposed, this might send events to
   /// another object.
-  Future<Null> longPress(Finder finder, { int pointer }) {
+  Future<void> longPress(Finder finder, { int pointer }) {
     return longPressAt(getCenter(finder), pointer: pointer);
   }
 
   /// Dispatch a pointer down / pointer up sequence at the given location with
   /// a delay of [kLongPressTimeout] + [kPressTimeout] between the two events.
-  Future<Null> longPressAt(Offset location, { int pointer }) {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> longPressAt(Offset location, { int pointer }) {
+    return TestAsyncUtils.guard<void>(() async {
       final TestGesture gesture = await startGesture(location, pointer: pointer);
       await pump(kLongPressTimeout + kPressTimeout);
       await gesture.up();
-      return null;
     });
   }
 
@@ -321,7 +319,7 @@
   /// opposite direction of the fling (e.g. dragging 200 pixels to the right,
   /// then fling to the left over 200 pixels, ending at the exact point that the
   /// drag started).
-  Future<Null> fling(Finder finder, Offset offset, double speed, {
+  Future<void> fling(Finder finder, Offset offset, double speed, {
     int pointer,
     Duration frameInterval = const Duration(milliseconds: 16),
     Offset initialOffset = Offset.zero,
@@ -363,7 +361,7 @@
   /// opposite direction of the fling (e.g. dragging 200 pixels to the right,
   /// then fling to the left over 200 pixels, ending at the exact point that the
   /// drag started).
-  Future<Null> flingFrom(Offset startLocation, Offset offset, double speed, {
+  Future<void> flingFrom(Offset startLocation, Offset offset, double speed, {
     int pointer,
     Duration frameInterval = const Duration(milliseconds: 16),
     Offset initialOffset = Offset.zero,
@@ -371,7 +369,7 @@
   }) {
     assert(offset.distance > 0.0);
     assert(speed > 0.0); // speed is pixels/second
-    return TestAsyncUtils.guard<Null>(() async {
+    return TestAsyncUtils.guard<void>(() async {
       final TestPointer testPointer = TestPointer(pointer ?? _getNextPointer());
       final HitTestResult result = hitTestOnBinding(startLocation);
       const int kMoveCount = 50; // Needs to be >= kHistorySize, see _LeastSquaresVelocityTrackerStrategy
@@ -394,7 +392,6 @@
         }
       }
       await sendEventToBinding(testPointer.up(timeStamp: Duration(milliseconds: timeStamp.round())), result);
-      return null;
     });
   }
 
@@ -407,7 +404,7 @@
   ///
   /// See also [SchedulerBinding.endOfFrame], which returns a future that could
   /// be appropriate to return in the implementation of this method.
-  Future<Null> pump(Duration duration);
+  Future<void> pump(Duration duration);
 
   /// Attempts to drag the given widget by the given offset, by
   /// starting a drag in the middle of the widget.
@@ -417,7 +414,7 @@
   ///
   /// If you want the drag to end with a speed so that the gesture recognition
   /// system identifies the gesture as a fling, consider using [fling] instead.
-  Future<Null> drag(Finder finder, Offset offset, { int pointer }) {
+  Future<void> drag(Finder finder, Offset offset, { int pointer }) {
     return dragFrom(getCenter(finder), offset, pointer: pointer);
   }
 
@@ -427,13 +424,12 @@
   /// If you want the drag to end with a speed so that the gesture recognition
   /// system identifies the gesture as a fling, consider using [flingFrom]
   /// instead.
-  Future<Null> dragFrom(Offset startLocation, Offset offset, { int pointer }) {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> dragFrom(Offset startLocation, Offset offset, { int pointer }) {
+    return TestAsyncUtils.guard<void>(() async {
       final TestGesture gesture = await startGesture(startLocation, pointer: pointer);
       assert(gesture != null);
       await gesture.moveBy(offset);
       await gesture.up();
-      return null;
     });
   }
 
@@ -468,10 +464,9 @@
   }
 
   /// Forwards the given pointer event to the binding.
-  Future<Null> sendEventToBinding(PointerEvent event, HitTestResult result) {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> sendEventToBinding(PointerEvent event, HitTestResult result) {
+    return TestAsyncUtils.guard<void>(() async {
       binding.dispatchEvent(event, result);
-      return null;
     });
   }
 
@@ -538,7 +533,7 @@
   LiveWidgetController(WidgetsBinding binding) : super(binding);
 
   @override
-  Future<Null> pump(Duration duration) async {
+  Future<void> pump(Duration duration) async {
     if (duration != null)
       await Future<void>.delayed(duration);
     binding.scheduleFrame();
diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart
index dda8377..15428da 100644
--- a/packages/flutter_test/lib/src/matchers.dart
+++ b/packages/flutter_test/lib/src/matchers.dart
@@ -1506,7 +1506,7 @@
   }
 }
 
-class _RendersOnPhysicalShape extends _MatchRenderObject<RenderPhysicalShape, Null> {
+class _RendersOnPhysicalShape extends _MatchRenderObject<RenderPhysicalShape, RenderPhysicalModel> {
   const _RendersOnPhysicalShape({
     this.shape,
     this.elevation,
@@ -1607,7 +1607,7 @@
     description.add('clips with bounding rounded rectangle with borderRadius: $borderRadius');
 }
 
-class _ClipsWithShapeBorder extends _MatchRenderObject<RenderClipPath, Null> {
+class _ClipsWithShapeBorder extends _MatchRenderObject<RenderClipPath, RenderClipRRect> {
   const _ClipsWithShapeBorder({@required this.shape});
 
   final ShapeBorder shape;
diff --git a/packages/flutter_test/lib/src/test_pointer.dart b/packages/flutter_test/lib/src/test_pointer.dart
index 56f2096..dea176d 100644
--- a/packages/flutter_test/lib/src/test_pointer.dart
+++ b/packages/flutter_test/lib/src/test_pointer.dart
@@ -113,7 +113,7 @@
 
 /// Signature for a callback that can dispatch events and returns a future that
 /// completes when the event dispatch is complete.
-typedef EventDispatcher = Future<Null> Function(PointerEvent event, HitTestResult result);
+typedef EventDispatcher = Future<void> Function(PointerEvent event, HitTestResult result);
 
 /// Signature for callbacks that perform hit-testing at a given location.
 typedef HitTester = HitTestResult Function(Offset location);
@@ -142,7 +142,7 @@
     assert(hitTester != null);
     assert(dispatcher != null);
     TestGesture result;
-    return TestAsyncUtils.guard<Null>(() async {
+    return TestAsyncUtils.guard<void>(() async {
       // dispatch down event
       final HitTestResult hitTestResult = hitTester(downLocation);
       final TestPointer testPointer = TestPointer(pointer);
@@ -150,8 +150,7 @@
 
       // create a TestGesture
       result = TestGesture._(dispatcher, hitTestResult, testPointer);
-      return null;
-    }).then<TestGesture>((Null value) {
+    }).then<TestGesture>((void value) {
       return result;
     }, onError: (dynamic error, StackTrace stack) {
       return Future<TestGesture>.error(error, stack);
@@ -163,14 +162,14 @@
   final TestPointer _pointer;
 
   /// Send a move event moving the pointer by the given offset.
-  Future<Null> moveBy(Offset offset, { Duration timeStamp = Duration.zero }) {
+  Future<void> moveBy(Offset offset, { Duration timeStamp = Duration.zero }) {
     assert(_pointer._isDown);
     return moveTo(_pointer.location + offset, timeStamp: timeStamp);
   }
 
   /// Send a move event moving the pointer to the given location.
-  Future<Null> moveTo(Offset location, { Duration timeStamp = Duration.zero }) {
-    return TestAsyncUtils.guard<Null>(() {
+  Future<void> moveTo(Offset location, { Duration timeStamp = Duration.zero }) {
+    return TestAsyncUtils.guard<void>(() {
       assert(_pointer._isDown);
       return _dispatcher(_pointer.move(location, timeStamp: timeStamp), _result);
     });
@@ -179,12 +178,11 @@
   /// End the gesture by releasing the pointer.
   ///
   /// The object is no longer usable after this method has been called.
-  Future<Null> up() {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> up() {
+    return TestAsyncUtils.guard<void>(() async {
       assert(_pointer._isDown);
       await _dispatcher(_pointer.up(), _result);
       assert(!_pointer._isDown);
-      return null;
     });
   }
 
@@ -193,12 +191,11 @@
   /// for instance).
   ///
   /// The object is no longer usable after this method has been called.
-  Future<Null> cancel() {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> cancel() {
+    return TestAsyncUtils.guard<void>(() async {
       assert(_pointer._isDown);
       await _dispatcher(_pointer.cancel(), _result);
       assert(!_pointer._isDown);
-      return null;
     });
   }
 }
diff --git a/packages/flutter_test/lib/src/test_text_input.dart b/packages/flutter_test/lib/src/test_text_input.dart
index 851ea9a..c6c1dbc 100644
--- a/packages/flutter_test/lib/src/test_text_input.dart
+++ b/packages/flutter_test/lib/src/test_text_input.dart
@@ -127,7 +127,7 @@
   /// Simulates the user pressing one of the [TextInputAction] buttons.
   /// Does not check that the [TextInputAction] performed is an acceptable one
   /// based on the `inputAction` [setClientArgs].
-  Future<Null> receiveAction(TextInputAction action) async {
+  Future<void> receiveAction(TextInputAction action) async {
     return TestAsyncUtils.guard(() {
       // Not using the `expect` function because in the case of a FlutterDriver
       // test this code does not run in a package:test test zone.
@@ -135,7 +135,7 @@
         throw TestFailure('Tried to use TestTextInput with no keyboard attached. You must use WidgetTester.showKeyboard() first.');
       }
 
-      final Completer<Null> completer = Completer<Null>();
+      final Completer<void> completer = Completer<void>();
 
       BinaryMessages.handlePlatformMessage(
         SystemChannels.textInput.name,
diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart
index bac856f..eff3f82 100644
--- a/packages/flutter_test/lib/src/widget_tester.dart
+++ b/packages/flutter_test/lib/src/widget_tester.dart
@@ -30,7 +30,7 @@
   isInstanceOf; // we have our own wrapper in matchers.dart
 
 /// Signature for callback to [testWidgets] and [benchmarkWidgets].
-typedef WidgetTesterCallback = Future<Null> Function(WidgetTester widgetTester);
+typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
 
 /// Runs the [callback] inside the Flutter test environment.
 ///
@@ -114,7 +114,7 @@
 ///       });
 ///       exit(0);
 ///     }
-Future<Null> benchmarkWidgets(WidgetTesterCallback callback) {
+Future<void> benchmarkWidgets(WidgetTesterCallback callback) {
   assert(() {
     print('┏╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍┓');
     print('┇ ⚠ THIS BENCHMARK IS BEING RUN WITH ASSERTS ENABLED ⚠  ┇');
@@ -136,7 +136,7 @@
   return binding.runTest(
     () => callback(tester),
     tester._endOfTestVerifications,
-  ) ?? Future<Null>.value();
+  ) ?? Future<void>.value();
 }
 
 /// Assert that `actual` matches `matcher`.
@@ -217,11 +217,11 @@
   ///
   /// See also [LiveTestWidgetsFlutterBindingFramePolicy], which affects how
   /// this method works when the test is run with `flutter run`.
-  Future<Null> pumpWidget(Widget widget, [
+  Future<void> pumpWidget(Widget widget, [
     Duration duration,
     EnginePhase phase = EnginePhase.sendSemanticsUpdate,
   ]) {
-    return TestAsyncUtils.guard<Null>(() {
+    return TestAsyncUtils.guard<void>(() {
       binding.attachRootWidget(widget);
       binding.scheduleFrame();
       return binding.pump(duration, phase);
@@ -240,11 +240,11 @@
   /// See also [LiveTestWidgetsFlutterBindingFramePolicy], which affects how
   /// this method works when the test is run with `flutter run`.
   @override
-  Future<Null> pump([
+  Future<void> pump([
     Duration duration,
     EnginePhase phase = EnginePhase.sendSemanticsUpdate,
   ]) {
-    return TestAsyncUtils.guard<Null>(() => binding.pump(duration, phase));
+    return TestAsyncUtils.guard<void>(() => binding.pump(duration, phase));
   }
 
   /// Repeatedly calls [pump] with the given `duration` until there are no
@@ -292,7 +292,7 @@
       return true;
     }());
     int count = 0;
-    return TestAsyncUtils.guard<Null>(() async {
+    return TestAsyncUtils.guard<void>(() async {
       final DateTime endTime = binding.clock.fromNowBy(timeout);
       do {
         if (binding.clock.now().isAfter(endTime))
@@ -300,7 +300,7 @@
         await binding.pump(duration, phase);
         count += 1;
       } while (binding.hasScheduledFrame);
-    }).then<int>((Null _) => count);
+    }).then<int>((void _) => count);
   }
 
   /// Runs a [callback] that performs real asynchronous work.
@@ -350,10 +350,9 @@
   }
 
   @override
-  Future<Null> sendEventToBinding(PointerEvent event, HitTestResult result) {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> sendEventToBinding(PointerEvent event, HitTestResult result) {
+    return TestAsyncUtils.guard<void>(() async {
       binding.dispatchEvent(event, result, source: TestBindingEventSource.test);
-      return null;
     });
   }
 
@@ -484,8 +483,8 @@
   ///
   /// Does not run timers. May result in an infinite loop or run out of memory
   /// if microtasks continue to recursively schedule new microtasks.
-  Future<Null> idle() {
-    return TestAsyncUtils.guard<Null>(() => binding.idle());
+  Future<void> idle() {
+    return TestAsyncUtils.guard<void>(() => binding.idle());
   }
 
   Set<Ticker> _tickers;
@@ -569,8 +568,8 @@
   ///
   /// Tests that just need to add text to widgets like [TextField]
   /// or [TextFormField] only need to call [enterText].
-  Future<Null> showKeyboard(Finder finder) async {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> showKeyboard(Finder finder) async {
+    return TestAsyncUtils.guard<void>(() async {
       final EditableTextState editable = state<EditableTextState>(
         find.descendant(
           of: finder,
@@ -592,8 +591,8 @@
   ///
   /// To just give [finder] the focus without entering any text,
   /// see [showKeyboard].
-  Future<Null> enterText(Finder finder, String text) async {
-    return TestAsyncUtils.guard<Null>(() async {
+  Future<void> enterText(Finder finder, String text) async {
+    return TestAsyncUtils.guard<void>(() async {
       await showKeyboard(finder);
       testTextInput.enterText(text);
       await idle();
diff --git a/packages/flutter_test/test/test_async_utils_test.dart b/packages/flutter_test/test/test_async_utils_test.dart
index 3c4f230..deffb3b 100644
--- a/packages/flutter_test/test/test_async_utils_test.dart
+++ b/packages/flutter_test/test/test_async_utils_test.dart
@@ -13,22 +13,22 @@
 // of this test is to see how we handle leaking APIs.
 
 class TestAPI {
-  Future<Null> testGuard1() {
-    return TestAsyncUtils.guard(() async { return null; });
+  Future<Object> testGuard1() {
+    return TestAsyncUtils.guard<Object>(() async { return null; });
   }
-  Future<Null> testGuard2() {
-    return TestAsyncUtils.guard(() async { return null; });
+  Future<Object> testGuard2() {
+    return TestAsyncUtils.guard<Object>(() async { return null; });
   }
 }
 
 class TestAPISubclass extends TestAPI {
-  Future<Null> testGuard3() {
-    return TestAsyncUtils.guard(() async { return null; });
+  Future<Object> testGuard3() {
+    return TestAsyncUtils.guard<Object>(() async { return null; });
   }
 }
 
-Future<Null> _guardedThrower() {
-  return TestAsyncUtils.guard(() async {
+Future<Object> _guardedThrower() {
+  return TestAsyncUtils.guard<Object>(() async {
     throw 'Hello';
   });
 }
@@ -36,7 +36,7 @@
 void main() {
   test('TestAsyncUtils - one class', () async {
     final TestAPI testAPI = TestAPI();
-    Future<Null> f1, f2;
+    Future<Object> f1, f2;
     f1 = testAPI.testGuard1();
     try {
       f2 = testAPI.testGuard2();
@@ -57,7 +57,7 @@
 
   test('TestAsyncUtils - two classes, all callers in superclass', () async {
     final TestAPI testAPI = TestAPISubclass();
-    Future<Null> f1, f2;
+    Future<Object> f1, f2;
     f1 = testAPI.testGuard1();
     try {
       f2 = testAPI.testGuard2();
@@ -78,7 +78,7 @@
 
   test('TestAsyncUtils - two classes, mixed callers', () async {
     final TestAPISubclass testAPI = TestAPISubclass();
-    Future<Null> f1, f2;
+    Future<Object> f1, f2;
     f1 = testAPI.testGuard1();
     try {
       f2 = testAPI.testGuard3();
@@ -99,7 +99,7 @@
 
   test('TestAsyncUtils - expect() catches pending async work', () async {
     final TestAPI testAPI = TestAPISubclass();
-    Future<Null> f1;
+    Future<Object> f1;
     f1 = testAPI.testGuard1();
     try {
       flutter_test.expect(0, 0);
@@ -119,7 +119,7 @@
   });
 
   testWidgets('TestAsyncUtils - expect() catches pending async work', (WidgetTester tester) async {
-    Future<Null> f1, f2;
+    Future<Object> f1, f2;
     try {
       f1 = tester.pump();
       f2 = tester.pump();
@@ -139,7 +139,7 @@
   });
 
   testWidgets('TestAsyncUtils - expect() catches pending async work', (WidgetTester tester) async {
-    Future<Null> f1;
+    Future<Object> f1;
     try {
       f1 = tester.pump();
       TestAsyncUtils.verifyAllScopesClosed();
@@ -155,7 +155,7 @@
   });
 
   testWidgets('TestAsyncUtils - expect() catches pending async work', (WidgetTester tester) async {
-    Future<Null> f1;
+    Future<Object> f1;
     try {
       f1 = tester.pump();
       TestAsyncUtils.verifyAllScopesClosed();