SyncClient constructor
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.
Implementation
SyncClient(this._store, String serverUri, SyncCredentials creds) {
if (!Sync.isAvailable()) {
throw UnsupportedError(
'Sync is not available in the loaded ObjectBox runtime library. '
'Please visit https://objectbox.io/sync/ for options.');
}
final cServerUri = serverUri.toNativeUtf8();
try {
_cSync = checkObxPtr(
C.sync_1(InternalStoreAccess.ptr(_store), cServerUri.cast()),
'failed to create sync client');
} finally {
malloc.free(cServerUri);
}
setCredentials(creds);
}