cancelSubscription method Null safety

Future<void> cancelSubscription(
  1. StreamSubscription? subscription
)

Cancels the subscription. The subscriber will stop receiving events

Implementation

Future<void> cancelSubscription(StreamSubscription? subscription) async {
  await subscription?.cancel();
  _subscriptions.remove(subscription);
}