ReactiveX / rxdart

The Reactive Extensions for Dart
http://reactivex.io
Apache License 2.0
3.37k stars 271 forks source link

DoStreamTransformer not behaving as expected #657

Open rbellens opened 2 years ago

rbellens commented 2 years ago

The DoStreamTransformer seems to be the only transformer that uses forwardStream with listenOnlyOnce argument equal to true. Don't exactly now what is the purpose of this argument, but it leads to some unexpected behavior in the following case:


var s = BehaviorSubject<dynamic>()..add(1);

var stream = s.doOnData((_) {});

var s1 = stream.listen((v) {
  print('$v'); // prints 1
});

await stream.first; // completes with value 1

await stream.first; // NEVER COMPLETES

await s1.cancel();
hoc081098 commented 2 years ago

I have seen this issue too, but if we use Stream.multi for doOnXXX, doOnXXX's callback will fire many times even source Stream is broadcast. https://github.com/ReactiveX/rxdart/pull/412#issue-577289261