clearAllSubscription method
Cancels all active subscriptions.
This is useful for cleanup before closing the WebSocket connection.
Implementation
Future clearAllSubscription() async {
if (_subscriptions.isNotEmpty) {
final keys = _subscriptions.keys.toList(); // Create a list of keys
for (var key in keys) {
unsubscribe(key);
}
_subscriptions.clear();
debugPrint("🚪 All subscriptions closed.");
}
}