add method

SubxMap add (Object key, 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 StreamSubscription oldSubscription = _subscriptionMap[key];

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

  _subscriptionMap[key] = value;

  return this;
}