CollaborativeSession class

Manages CRDT-based state synchronization for a set of CollaborativeReacton instances over a SyncChannel.

A session is created via ReactonStoreCollab.collaborate and handles:

  • Subscribing to local changes and broadcasting deltas to peers
  • Receiving remote deltas and merging them into local state
  • Full-state sync for newly connected peers
  • Conflict detection and notification
  • Graceful disconnect and resource cleanup

Lifecycle

// 1. Create the session (starts syncing immediately)
final session = store.collaborate(
  channel: channel,
  reactons: [counter, tags],
);

// 2. Monitor sync status
session.syncStatus.listen((status) => print('Status: $status'));

// 3. Monitor conflicts
session.onConflict.listen((event) => print('Conflict: $event'));

// 4. Disconnect when done
await session.disconnect();
Mixed-in types

Properties

currentStatus SyncStatus
The current synchronization status.
no setter
hashCode int
The hash code for this object.
no setterinherited
isConnected bool
Whether the session is currently connected and actively syncing.
no setter
isDisposed bool
Whether this object has been disposed.
no setterinherited
localNodeId String
The local node identifier from the underlying SyncChannel.
no setter
onConflict Stream<ConflictEvent<Object?>>
A stream of ConflictEvents emitted whenever a concurrent update is detected and resolved by a CrdtMergeStrategy.
no setter
peers Set<String>
The set of known peer node IDs that have communicated with this session.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
syncStatus Stream<SyncStatus>
A stream of SyncStatus changes reflecting the session's connection state.
no setter

Methods

assertNotDisposed() → void
Assert that this object has not been disposed.
inherited
disconnect() Future<void>
Disconnects the session and releases all resources.
dispose() → void
Release all resources. Called automatically by the store when the reacton is no longer needed.
inherited
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