Skip to main content

Multi-device channel sync

Sync remote channels

When logged in on multiple devices, call BaseChannel.syncRemoteChannels() to sync channel data across devices.

Method

Dart
static Future<int> syncRemoteChannels(ErrorHandler handler)

Code example

Dart
await BaseChannel.syncRemoteChannels((error) {
if (error?.isSuccess == true) {
print('Remote channels synced');
}
});

Listen for channel sync

Register a ChannelHandler to receive notifications when remote channel data has been synced:

Dart
NCEngine.addChannelHandler('sync-handler', ChannelHandler(
onRemoteChannelsSyncCompleted: (event) {
if (event.error?.isSuccess == true) {
print('Remote channel sync completed');
}
},
));
note

In the current Flutter wrapper, event.error is reported as NCError(code: 0) on success instead of null.