netCoreSyncSynchronize method
Future<SyncResult>
netCoreSyncSynchronize({
- required String url,
- SyncEvent? syncEvent,
- SyncResultLogLevel syncResultLogLevel = SyncResultLogLevel.fullData,
- Map<
String, dynamic> customInfo = const {},
Starts the synchronization process.
The url
is the NETCoreSyncServer
websocket url that is already setup
to receive synchronization requests. The syncEvent
is an instance of
SyncEvent to monitor the synchronization progress. The
syncResultLogLevel
is a SyncResultLogLevel enum
to determine the
verbosity of the log results in the returned SyncResult
. The
customInfo
is a custom information that can be passed on to the
server-side for information that is not covered by this framework. The
returned SyncResult
carries errors information (if any) and detailed
log results.
Please read the Client Side Synchronization
in the netcoresync_moor
documentation for more details.
Implementation
Future<SyncResult> netCoreSyncSynchronize({
required String url,
SyncEvent? syncEvent,
SyncResultLogLevel syncResultLogLevel = SyncResultLogLevel.fullData,
Map<String, dynamic> customInfo = const {},
}) async {
if (!netCoreSyncInitialized) throw NetCoreSyncNotInitializedException();
if (dataAccess.syncIdInfo == null) {
throw NetCoreSyncSyncIdInfoNotSetException();
}
if (dataAccess.inTransaction()) {
throw NetCoreSyncMustNotInsideTransactionException();
}
SyncSession syncSession = SyncSession(
dataAccess: dataAccess,
url: url,
syncEvent: syncEvent,
syncResultLogLevel: syncResultLogLevel,
customInfo: customInfo,
);
return syncSession.synchronize();
}