stream property

Stream<S?> stream

Broadcast Stream to which all builders listen

This stream is created only when there is a listener, and is automatically cleaned when there are no listeners are left. State change broadcasts are discarded when there are no listeners.

Implementation

Stream<S?> get stream {
  _monitor.onStreamListener(runtimeType.toString());
  if (_stream == null) {
    _stream =
        _state == null ? BehaviorSubject<S>() : BehaviorSubject.seeded(state);

    _stream!.onCancel = () {
      if (_stream != null && !_stream!.hasListener) {
        _monitor.onStreamDispose(runtimeType.toString());
        _stream!.close();
        _stream = null;
      }
    };
  }

  return _stream!.stream;
}