cancel method

void cancel()

Implementation

void cancel() {
  if (isCancelled) return;
  _completion.complete();
  for (final callback in List.of(_listeners)) {
    callback();
  }
  _listeners.clear();
}