stream property

Stream<T> get stream

A broadcast view of the events delivered to this subscription.

It is a UI convenience, not a second delivery path with its own buffer: events are added when the subscription delivers them, so a view with no listeners loses them.

Implementation

Stream<T> get stream {
  if (_canceled) return const Stream.empty();
  final existing = _view;
  if (existing != null) return existing.stream;
  final controller = StreamController<T>.broadcast();
  _view = controller;
  return controller.stream;
}