client static method

SyncClient client(
  1. Store store,
  2. String serverUri,
  3. SyncCredentials creds
)

Creates a sync client associated with the given store and configures it with the given options. This does not initiate any connection attempts yet, call SyncClient.start() to do so.

Before SyncClient.start(), you can still configure some aspects of the client, e.g. its SyncRequestUpdatesMode mode.

Implementation

static SyncClient client(
    Store store, String serverUri, SyncCredentials creds) {
  if (syncClientsStorage.containsKey(store)) {
    throw StateError('Only one sync client can be active for a store');
  }
  final client = SyncClient(store, serverUri, creds);
  syncClientsStorage[store] = client;
  InternalStoreAccess.addCloseListener(store, client, client.close);
  return client;
}