EventStream<T>.fromStream constructor

EventStream<T>.fromStream(
  1. Stream<T> stream, [
  2. T? initialValue
])

Creates a EventStream from a Stream. Data emitted by stream will also be emitted by this EventStream. Values can also be emitted 'manually' to this EventStream using regular methods. This EventStream will NOT be closed if stream is done: only the internal subscription will be cancelled when this EventStream is closed.

Implementation

EventStream.fromStream(Stream<T> stream, [super.initialValue]) {
  _fromStreamSubscription = stream.listen(add, onError: addError);
}