Skip to content

Regression when switchMap is used together with asynchronous generator #764

Open
@ky1vstar

Description

@ky1vstar

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

import 'package:rxdart/rxdart.dart';

void main(List<String> arguments) async {
  getStream().listen(print);
}

Stream<String> getStream() {
  final stream1 = Future.delayed(Duration(seconds: 1), () => "1").asStream();
  final stream2 = stream1.startWith("2");

  final stream3 = stream2.switchMap((value) async* {
    await for (final innerValue in BehaviorSubject.seeded(value)) {
      yield innerValue;
    }
  });

  return stream3;
}

Expected result (rxdart 0.27.7):

2
1

Actual result (rxdart 0.28.0):

2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions