3.0.1
has some important bug fixes for Sync, we recommend to update to this version.android/app/build.gradle
set minSdkVersion 21
in section android -> defaultConfig
pubspec.yaml
file as usual:--sync
argument to the script:start()/buildAndStart()
. It will then try to connect to the server, authenticate and start syncing. Read below for more configuration options you can use before starting the connection. wss
as the protocol in the server URL a TLS encrypted connection is established. Use ws
instead to turn off transport encryption (insecure, not recommended! e.g. only use for testing).loginListener(listener)
to observe login events.completedListener(listener)
to observe when synchronization has completed.connectionListener(listener)
to observe connection events.listener(listener)
to observe all of the above events. Use AbstractSyncListener
and only override methods of interest to simplify your listener implementation.SyncClient.setSyncListener(listener)
and related methods.loginListener(listener)
to observe login events.completedListener(listener)
to observe when synchronization has completed.connectionListener(listener)
to observe connection events.listener(listener)
to observe all of the above events. Use AbstractSyncListener
and only override methods of interest to simplify your listener implementation.SyncClient.setSyncListener(listener)
and related methods.loginListener
to observe login events.completedListener
to observe when synchronization has completed.connectionListener
to observe connection events.listener
to observe all of the above events.nil
.SyncClient
getters to connect to a stream:Stream<SyncLoginEvent> get loginEvents
- such as logged-in, credentials-rejected.Stream<void> get completionEvents
to observe when synchronization has completed.Stream<SyncConnectionEvent> get connectionEvents
to observe connection events.changeListener(changeListener)
when building the client and pass a SyncChangeListener
to receive detailed information for each sync update. Or set or remove it at any later point using SyncClient.setSyncChangeListener(changeListener)
.changeListener(changeListener)
when building the client and pass a SyncChangeListener
to receive detailed information for each sync update. Or set or remove it at any later point using SyncClient.setSyncChangeListener(changeListener)
.Stream<List<SyncChange>> get changeEvents
on the SyncClient to receive detailed information for each sync update. Make sure to cancel the subscription when you don't need the information anymore to clear up resources.