ObservableStream<T> constructor

ObservableStream<T>(
  1. Stream<T> stream, {
  2. T? initialValue,
  3. bool cancelOnError = false,
  4. ReactiveContext? context,
  5. String? name,
  6. EqualityComparer? equals,
})

Create a stream that tracks the emitted values of the provided stream and makes them available as a MobX observable value.

If the source stream is a single-subscription stream, this stream will also be single-subscription. If the source stream is a broadcast stream, this stream will also be a broadcast stream.

If initialValue is provided, value will use it as the initial value while waiting for the first item to be emitted from the source stream. If the stream is a single-subscription stream, initialValue will also be the first value emitted to the subscription created by listen.

If cancelOnError is true, the stream will be cancelled when an error event is emitted by the source stream. The default value is false.

It is possible to override equality comparison of new values with equals.

Implementation

ObservableStream(Stream<T> stream,
    {T? initialValue,
    bool cancelOnError = false,
    ReactiveContext? context,
    String? name,
    EqualityComparer<dynamic>? equals})
    : this._(context ?? mainContext, stream, initialValue, cancelOnError,
          name, equals);