Replace Future.wait with Iterable<Future>.wait (dart-lang/stream_transform#188)

Towards dart-lang/stream_transform#111
diff --git a/pkgs/stream_transform/lib/src/aggregate_sample.dart b/pkgs/stream_transform/lib/src/aggregate_sample.dart
index aa47c1e..0d53d8a 100644
--- a/pkgs/stream_transform/lib/src/aggregate_sample.dart
+++ b/pkgs/stream_transform/lib/src/aggregate_sample.dart
@@ -138,7 +138,7 @@
         // Handle opt-out nulls
         cancels.removeWhere((Object? f) => f == null);
         if (cancels.isEmpty) return null;
-        return Future.wait(cancels).then((_) => null);
+        return cancels.wait.then((_) => null);
       };
     };
     return controller.stream;
diff --git a/pkgs/stream_transform/lib/src/async_expand.dart b/pkgs/stream_transform/lib/src/async_expand.dart
index 98d8bb7..e9de12e 100644
--- a/pkgs/stream_transform/lib/src/async_expand.dart
+++ b/pkgs/stream_transform/lib/src/async_expand.dart
@@ -81,7 +81,7 @@
         var cancels = [for (var s in subscriptions) s.cancel()]
           // Handle opt-out nulls
           ..removeWhere((Object? f) => f == null);
-        return Future.wait(cancels).then((_) => null);
+        return cancels.wait.then((_) => null);
       };
     };
     return controller.stream;
diff --git a/pkgs/stream_transform/lib/src/combine_latest.dart b/pkgs/stream_transform/lib/src/combine_latest.dart
index 15c1b68..fe9e249 100644
--- a/pkgs/stream_transform/lib/src/combine_latest.dart
+++ b/pkgs/stream_transform/lib/src/combine_latest.dart
@@ -133,7 +133,7 @@
           ..removeWhere((Object? f) => f == null);
         sourceSubscription = null;
         otherSubscription = null;
-        return Future.wait(cancels).then((_) => null);
+        return cancels.wait.then((_) => null);
       };
     };
     return controller.stream;
@@ -234,7 +234,7 @@
           // Handle opt-out nulls
           ..removeWhere((Object? f) => f == null);
         if (cancels.isEmpty) return null;
-        return Future.wait(cancels).then((_) => null);
+        return cancels.wait.then((_) => null);
       };
     };
     return controller.stream;
diff --git a/pkgs/stream_transform/lib/src/merge.dart b/pkgs/stream_transform/lib/src/merge.dart
index 2725d5e..3180c02 100644
--- a/pkgs/stream_transform/lib/src/merge.dart
+++ b/pkgs/stream_transform/lib/src/merge.dart
@@ -94,7 +94,7 @@
           // Handle opt-out nulls
           ..removeWhere((Object? f) => f == null);
         if (cancels.isEmpty) return null;
-        return Future.wait(cancels).then((_) => null);
+        return cancels.wait.then((_) => null);
       };
     };
     return controller.stream;
diff --git a/pkgs/stream_transform/lib/src/switch.dart b/pkgs/stream_transform/lib/src/switch.dart
index d64fc07..95abd26 100644
--- a/pkgs/stream_transform/lib/src/switch.dart
+++ b/pkgs/stream_transform/lib/src/switch.dart
@@ -128,7 +128,7 @@
           // Handle opt-out nulls
           ..removeWhere((Object? f) => f == null);
         if (cancels.isEmpty) return null;
-        return Future.wait(cancels).then(_ignore);
+        return cancels.wait.then(_ignore);
       };
     };
     return controller.stream;
diff --git a/pkgs/stream_transform/test/scan_test.dart b/pkgs/stream_transform/test/scan_test.dart
index a0311c5..3c749e7 100644
--- a/pkgs/stream_transform/test/scan_test.dart
+++ b/pkgs/stream_transform/test/scan_test.dart
@@ -59,7 +59,7 @@
           const TypeMatcher<Future<void>>(),
           const TypeMatcher<Future<void>>()
         ]);
-        expect(await Future.wait(result), [1, 3]);
+        expect(await result.wait, [1, 3]);
       });
 
       test('does not call for subsequent values while waiting', () async {