manageStreamSubscription method

  1. @deprecated
  2. @mustCallSuper
  3. @override
void manageStreamSubscription (StreamSubscription subscription)
@mustCallSuper, override

Automatically cancel a stream subscription when this object is disposed.

This method should not be used for subscriptions that will be canceled manually by the consumer because we have no way of knowing when a subscription is canceled, so we will hold on to the reference until the parent object is disposed.

The parameter may not be null.

Deprecated: 1.7.0 To be removed: 2.0.0

Use listenToStream instead. One will need to update to DisposableManagerV4 or above for this.


void manageStreamSubscription(StreamSubscription subscription) {
      'manageStreamSubscription', 'subscription', subscription);

  _internalDisposables.add(new ManagedDisposer(() => subscription.cancel()));