SyncClient class

Sync client is used to connect to an ObjectBox sync server.

Constructors

SyncClient(Store _store, String serverUri, SyncCredentials creds)
Creates a sync client associated with the given store and options. This does not initiate any connection attempts yet: call start() to do so.

Properties

changeEvents Stream<List<SyncChange>>
Get a broadcast stream of incoming synced data changes.
no setter
completionEvents Stream<void>
Get a broadcast stream of sync completion events - when synchronization of incoming changes has completed.
no setter
connectionEvents Stream<SyncConnectionEvent>
Get a broadcast stream of connection state changes (connect/disconnect).
no setter
hashCode int
The hash code for this object.
no setterinherited
loginEvents Stream<SyncLoginEvent>
Get a broadcast stream of login events (success/failure).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelUpdates() bool
Cancel updates from the server so that it will stop sending updates. See also requestUpdates().
close() → void
Closes and cleans up all resources used by this sync client. It can no longer be used afterwards, make a new sync client instead. Does nothing if this sync client has already been closed.
isClosed() bool
Returns if this sync client is closed and can no longer be used.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outgoingMessageCount({int limit = 0}) int
Count the number of messages in the outgoing queue, i.e. those waiting to be sent to the server.
requestUpdates({required bool subscribeForFuturePushes}) bool
Request updates since we last synchronized our database.
setCredentials(SyncCredentials creds) → void
Configure authentication credentials, depending on your server config.
setRequestUpdatesMode(SyncRequestUpdatesMode mode) → void
Configures how sync updates are received from the server. If automatic updates are turned off, they will need to be requested manually.
start() → void
Once the sync client is configured, you can start it to initiate synchronization.
state() SyncState
Gets the current sync client state.
stop() → void
Stops this sync client. Does nothing if it is already stopped.
toString() String
A string representation of this object.
inherited

Operators

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