ObservableView<T>.fromStream constructor

ObservableView<T>.fromStream(
  1. Stream<T> stream, {
  2. T? initialValue,
})

An ObservableView of the most-recently-published value on the given stream.

Implementation

factory ObservableView.fromStream(Stream<T> stream, {T? initialValue}) {
  var instance = ObservableReference(initialValue);
  instance.listen(stream);
  return instance as ObservableView<T>;
  //return ObservableReference(initialValue)..listen(stream);
}