You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is not only with the asynchronous generator, but also with someFuture.asStream too.
Here is the test that will fail on 0.28.0 but succeed on 0.27.7
testWidgets('switchMap regression test', (tester) async {
const delay = Duration(seconds: 1);
Future<String> someFuture(String value) async {
await Future<void>.delayed(delay);
return value;
}
final subject = PublishSubject<String>();
final beforeSwitchMap = <String>[];
final afterSwitchMap = <String>[];
subject
.doOnData(beforeSwitchMap.add)
.switchMap(
(value) => someFuture(value).asStream(),
)
.doOnData(afterSwitchMap.add)
.listen((event) {
debugPrint('event: $event');
});
await tester.pump(const Duration(seconds: 2));
subject.add('1');
await tester.pump(const Duration(seconds: 2));
subject.add('2');
// Delay before next value < [delay] will fail the test in 0.28.0
await tester.pump(delay - const Duration(microseconds: 1));
subject.add('3');
await tester.pump(const Duration(seconds: 2));
subject.add('4');
await tester.pump(const Duration(seconds: 2));
expect(beforeSwitchMap, ['1', '2', '3', '4']);
// Next line will succeed in 0.27.7 but fail in 0.28.0
// with the message:
// Expected: ['1', '3', '4']
// Actual: ['1']
expect(afterSwitchMap, ['1', '3', '4']);
});
I can't reproduce the same behavior in runtime. Only widget tests seem to be affected (26 of our tests are red now ).
Here is minimal reproducible example for regression which I found during migration from
rxdart
0.27.7 to 0.28.0.Dart SDK version: 3.5.1
Source code
Expected result (rxdart 0.27.7):
Actual result (rxdart 0.28.0):
The text was updated successfully, but these errors were encountered: