addListener method

void addListener(
  1. Rx<T> rx
)

Implementation

void addListener(Rx<T> rx) {
  // if the current observable is not in the subscriptions
  if (!_subscriptions.containsKey(rx)) {
    // create a Subscription for this observable
    final StreamSubscription subs = rx.stream.listen(subject.controller.add);

    /// get the subscriptions for this Rx and add the new subscription
    final listSubscriptions = _subscriptions[rx] ?? [];
    listSubscriptions.add(subs);
    _subscriptions[rx] = listSubscriptions;
  }
}