attach method

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

Attaches a Cancellable to this token.

Before attaching to a CancellationToken, you should check if it's already been cancelled by using isCancelled.

Implementation

@override
void attach(Cancellable cancellable) {
  if (!isCancelled && _timer == null) Timer(_duration, _onTimerEnd);
  super.attach(cancellable);
}