RealtimeQueryBridge class

Bridges Realtime channel broadcasts to the BloomData client query cache.

When a broadcast arrives on a channel, this bridge automatically triggers BloomData.invalidateQueries for the specified query key (or when a custom filter predicate matches). This immediately causes active BloomQuery components and reactive listeners tracking the key to refetch in the background.

Example

final bridge = RealtimeQueryBridge.bind(
  client: realtimeClient,
  channel: 'todos:42',
  key: ['todos', 42],
  filter: (payload) => payload['type'] == 'updated',
);

// Later, when component unmounts or subscription is no longer needed:
bridge.cancel();

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel() → void
Cancels the underlying stream subscription and stops query invalidations.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

bind({required BloomRealtimeClient client, required String channel, required List key, bool filter(Map<String, dynamic> payload)?}) RealtimeQueryBridge
Listens to a realtime channel on client and calls BloomData.invalidateQueries with key on every received message, or when filter matches.
bindStream({required Stream<Map<String, dynamic>> stream, required List key, bool filter(Map<String, dynamic> payload)?}) RealtimeQueryBridge
Listens to an existing channel stream and calls BloomData.invalidateQueries with key on every message (or when filter returns true).