sync abstract method

void sync({
  1. @Deprecated('Use SyncProgressListener') Function? onDone,
  2. Function? onError,
})

Sync local secondary and cloud secondary.

NB: With current SyncServiceImpl this may not immediately sync. Instead, it will enqueue a request for sync to take place.

This method will be obsolete in the forthcoming alternative implementation which takes an event-driven streaming approach to syncing. Instead of requesting a sync, you will request that processing of the data events (whether originating from client or server) be paused or resumed or re-initialized

If local secondary is ahead, pushes the changes to the cloud secondary. If cloud secondary is ahead, pulls the changes to the local secondary.

Register to onDone callback. The callback accepts instance of SyncResult.

Usage

var syncService = AtClientManager.getInstance().syncService;

syncService.sync(_onDoneCallback); //or
syncService.sync();

// Called when sync process is successful.
void _onDoneCallback(syncResult){
  print(syncResult.syncStatus);
  print(syncResult.lastSyncedOn);
}

Implementation

void sync(
    {@Deprecated('Use SyncProgressListener') Function? onDone,
    Function? onError});