add method

SubxMap add(
  1. Object key,
  2. StreamSubscription value
)

Add or update a StreamSubscription to the list with a specified key. Will unsubscribe a Subscription when updating a existing key.

For example:

subxMap.add('key', observable.listen(...));

Implementation

SubxMap add(Object key, StreamSubscription<dynamic> value) {
  final oldSubscription = _subscriptionMap[key];

  if (oldSubscription != null && oldSubscription != value) {
    oldSubscription.cancel();
  }

  _subscriptionMap[key] = value;

  return this;
}