cancel method

void cancel()

Cancel the operation associated with this token.

This will cause any in-flight operation to be terminated and complete with a CancelledException.

Calling cancel multiple times has no additional effect.

Implementation

void cancel() {
  if (!_isCancelled) {
    _isCancelled = true;
    _controller.add(null);
  }
}