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(this);
if (_stream == null) {
_stream =
_state == null ? BehaviorSubject<S>() : BehaviorSubject.seeded(state);
_stream!.onCancel = () {
if (_stream != null && !_stream!.hasListener) {
_notifyListeners(BlocEventType.streamClosed);
_monitor.onStreamDispose(this);
_stream!.close();
_stream = null;
}
};
}
_notifyListeners(BlocEventType.newDependent);
return _stream!.stream;
}