cancelForKey method

Future<bool> cancelForKey (Object key)

Cancel a StreamSubscription with a specified key and remove it from list

For example:

subxMap.cancelForKey('key');

Implementation

Future<bool> cancelForKey(Object key) async {
  if (_subscriptionMap.containsKey(key)) {
    StreamSubscription subscription = _subscriptionMap.remove(key);
    await subscription.cancel();
    return true;
  }

  return false;
}