CollectionWatcher class
Collection watcher for real-time document updates
Watches a collection for create, update, and delete events with automatic reconnection.
Example:
final watcher = CollectionWatcher('books', apiKey);
watcher.onCreate((data) {
print('New document: ${data['data']}');
});
watcher.onUpdate((data) {
print('Updated document: ${data['data']}');
});
watcher.onDelete((data) {
print('Deleted document: ${data['data']}');
});
watcher.connect();
// Later, when done
watcher.disconnect();
Constructors
Properties
Methods
-
connect(
) → void - Connect to the collection WebSocket
-
disconnect(
) → void - Disconnect from the WebSocket
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onClose(
Listener callback) → void - Called when connection is closed
-
onConnected(
Listener callback) → void - Called when connection is established
-
onCreate(
Listener callback) → void - Called when a document is created
-
onDelete(
Listener callback) → void - Called when a document is deleted
-
onError(
Listener callback) → void - Called when an error occurs
-
onUpdate(
Listener callback) → void - Called when a document is updated
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited