manageDisposable method

  1. @mustCallSuper
  2. @override
void manageDisposable (Disposable disposable)
@mustCallSuper, override

Automatically dispose another object when this object is disposed.

The parameter may not be null.

Deprecated: 1.8.0 To be removed: 2.0.0

Use manageAndReturnTypedDisposable instead. One will need to update to DisposableManagerV7 or above for this.

Implementation

@mustCallSuper
@override
void manageDisposable(Disposable disposable) {
  _throwOnInvalidCall('manageDisposable', 'disposable', disposable);
  _logManageMessage(disposable);

  _internalDisposables.add(disposable);
  disposable.didDispose.then((_) {
    // ignore: deprecated_member_use
    if (!isDisposedOrDisposing) {
      _logUnmanageMessage(disposable);
      _internalDisposables.remove(disposable);
    }
  });
}