Closed agavrilko closed 1 year ago
I checked implementation of the transformer, and I see why it does not behave as I expected. The default element is sent when stream finishes.
@override
void close() {
if (_isEmpty) {
_outputSink.add(_defaultValue);
}
_outputSink.close();
}
So considering implementation, the behavior is absolutely understandable and reasonable. Closing the issue.
The dartpad example: https://dartpad.dev/?id=2026d54c6966dc503dbe7b9eb3a148fc
Description
The stream returned from
defaultIfEmpty
method does not emit value if it was called on BehaviorSubject instance.Example
An example below fails by timeout, which is not expected. Test should pass.