cancel method

Future<void> cancel()

Cancels the subscription.

This disposes internal streams, so the subscription becomes unusable.

Implementation

Future<void> cancel() async {
  if (isCancelled) {
    _logger.warning(
        'Tried cancelling a subscription that is already cancelled.');
    return;
  }

  _logger.verbose('Subscription cancelled.');

  await _envelopeSubscription?.cancel();
  await _envelopesController.close();

  _cancelCompleter.complete();

  _manager.removeSubscription(this);
}