cancel method

void cancel()

Cancels the current subscription.

Implementation

void cancel() {
  assert(
    !isCanceled,
    'Cancel can only be called once.',
  );

  _unsubscribe();
  _isCanceled = true;

  for (final callback in _onCancelCallbacks) {
    callback();
  }
}