DataStream<T>.fromStream constructor
Creates a DataStream from a Stream.
Data emitted by stream
will also be emitted by this EventStream.
Values can also be emitted 'manually' to this DataStream using regular methods.
This DataStream will NOT be closed if stream
is done: only the internal subscription will be cancelled when this DataStream is closed.
If onError
is provided, it will be called when an error is emitted by stream
. Otherwise error events will be ignored.
Implementation
DataStream.fromStream(Stream<T> stream, super.initialValue, {Function? onError}) {
_fromStreamSubscription = stream.listen(add, onError: onError ?? (e) {});
}