remove method

  1. @override
Future<bool> remove(
  1. Object disposable
)
override

Removes and disposes the given disposable if it is part of this container.

disposable must be a StreamSubscription or a Sink.

Returns a Future completes with true if disposable was in this bag, and false if not. The method has no effect if disposable was not in this bag. See DisposeBagBase.delete.

Throws DisposedException or ClearingException if this bag has been disposed or is disposing.

Implementation

@override
Future<bool> remove(Object disposable) async {
  final removed = delete(disposable);
  if (removed) {
    await _disposeOne(disposable);
  }
  return removed;
}