diff --git a/flutter_client/test/cache/cache_first_test.dart b/flutter_client/test/cache/cache_first_test.dart index 9f99e2be..ff286873 100644 --- a/flutter_client/test/cache/cache_first_test.dart +++ b/flutter_client/test/cache/cache_first_test.dart @@ -36,7 +36,11 @@ void main() { // (still-empty) rows after the fetch returns, so the stream // never hangs when populate is a no-op for this filter. The // simulated drift re-emit then yields the populated rows. - final emissions = await results.take(2).toList(); + // Capture the Future *before* feeding the controller so the + // listener is subscribed when the first add() lands. + final emissionsFuture = results.take(2).toList(); + controller.add([]); + final emissions = await emissionsFuture; expect(emissions, [0, 42]); expect(fetchCalled, 1); await controller.close();