stopSubscriptionForChannel method

void stopSubscriptionForChannel(
  1. Channel channel,
  2. String event
)

Implementation

void stopSubscriptionForChannel(Channel channel, String event) {
  var subscriptionStack = _subscriptions[event];

  if (subscriptionStack?.isNotEmpty ?? false) {
    for (var tempSub in subscriptionStack!) {
      var options = tempSub.options;

      if (options != null) {
        var channelName = options['channel'] as String?;

        if (channelName == channel.channelName) tempSub.stop();
      }
    }
  }
}