unsubscribeFromPlugin method

void unsubscribeFromPlugin(
  1. String pluginName,
  2. String group
)

Unsubscribe from the given plugin

Implementation

void unsubscribeFromPlugin(String pluginName, String group) {
  // Find the requested unsub script and remove it
  final key = '$pluginName:$group';
  if (!subs.plugins.contains(key)) {
    // If we cannot find this subscription in this.subs.plugins, throw an error
    // We do not want an app developer thinking they have unsubscribed from something
    throw ValidationException(
      'No existing sub at pluginName="$pluginName", group="$group"',
    );
  }

  // Remove the requested subscription from this.subs.plugins
  subs.plugins.remove(key);

  if (ws != null) {
    // Send unsubscribe msg to chronik server
    _subUnsubPlugin(
      true,
      WsSubPluginClient(pluginName: pluginName, group: group),
    );
  }
}