detachCancellable method

  1. @override
void detachCancellable(
  1. Cancellable cancellable
)
override

Detaches a Cancellable from this token.

If this token has no remaining attached cancellables after detaching, it will also detach itself from the merged tokens.

Implementation

@override
void detachCancellable(Cancellable cancellable) {
  if (!isCancelled) _attachedCancellables.remove(cancellable);
  if (_attachedCancellables.isEmpty) {
    for (final CancellationToken token in _tokens) {
      token.detachCancellable(this);
    }
  }
}