stopObserving method
- String key,
- void listener(
- String? value,
- Participant? updatedBy
Stops listener observing key.
Local cleanup always succeeds; when it was the key's last listener the server is told too, which needs a joined room.
Example
await room.realtimeStore.stopObserving("BLOCK_CHAT", onBlockChat);
Implementation
Future<void> stopObserving(
String key,
void Function(String? value, Participant? updatedBy) listener,
) async {
final onEvent = _observers[key]?.remove(listener);
if (onEvent == null) return;
_realtimeStoreEventEmitter?.remove(key, onEvent);
if (_observers[key]!.isNotEmpty) return;
_observers.remove(key);
if (!_ensureJoined("realtimeStore.stopObserving")) return;
await _stopObserveInternal(key);
}