1 minute read
Apps can subscribe to the network availability callback service to know when the network goes off and on. Some of the services offered by SDK is subscribing to this service internally.
final ConnectivityListener connectivityListener = ConnectivityListener();
connectivityListener.subscribe().listen((isConnected) {
if(isConnected) {
print('connected');
} else {
print('disconnected');
}
});
// call this when app is closed or you no longer need the subscription
connectivityListener.unSubscribe()
Notification Response Object.
class AtNotification {
late String id;
late String key;
late String from;
late String to;
late int epochMillis;
String? value;
String? operation;
}
Sync Response Object
class SyncResult {
SyncStatus syncStatus = SyncStatus.not_started;
AtClientException? atClientException;
DateTime? lastSyncedOn;
bool dataChange = true;
}
enum SyncStatus { not_started, success, failure }