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();
The
DoStreamTransformer
seems to be the only transformer that usesforwardStream
withlistenOnlyOnce
argument equal totrue
. Don't exactly now what is the purpose of this argument, but it leads to some unexpected behavior in the following case: