cancel method

  1. @override
void cancel()
override

Cancels the subscription without requiring callers to await a Future.

Implementation

@override
void cancel() {
  if (_isCancelled) {
    return;
  }

  _isCancelled = true;
  final onCancel = _onCancel;
  _onCancel = null;
  onCancel?.call();
  unawaited(_subscription.cancel());
}