SyncClient class

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

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.
protocolVersionServer() → int
Returns the protocol version of the server after a connection is established (or attempted), zero otherwise.
putFilterVariable(String name, String value) → void
Adds or replaces a Sync filter variable value for the given name.
removeAllFilterVariables() → void
Removes all previously added Sync filter variable values.
removeFilterVariable(String name) → void
Removes a previously added Sync filter variable value.
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.
setMultipleCredentials(List<SyncCredentials> credentials) → void
Like setCredentials, but accepts multiple credentials.
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
triggerReconnect() → bool
Triggers a reconnection attempt immediately. Returns if a reconnect was actually triggered.

Operators

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

Static Methods

protocolVersion() → int
Returns the protocol version this client uses.