cancel method

void cancel([
  1. String? reason
])

Requests cancellation of any active requests bound to this token.

Implementation

void cancel([String? reason]) {
  if (_isCancelled) return;
  _isCancelled = true;
  _reason = reason;
  if (!_cancelCompleter.isCompleted) {
    _cancelCompleter.complete();
  }
}