subscribe method

  1. @override
Subscription<T> subscribe(
  1. StreamSubscriber<T> observer
)
override

Attaches a StreamSubscriber, which will be invoked when new items are available from the stream.

observer The subscriber to attach.

Returns a subscription that can be disposed to terminate the stream and stop calling methods on the StreamSubscriber.

Implementation

@override
Subscription<T> subscribe(StreamSubscriber<T> observer) {
  observers.add(observer);
  return _SubjectSubscription(this, observer);
}