isEventSyncRealTimeEnabled method
Retrieves the current real-time event synchronization setting.
Returns whether the SDK is currently configured to synchronize driving events and trip data immediately as they occur, or to batch them for later synchronization.
Returns:
bool:trueif real-time sync is enabled,falsefor batch sync
Usage:
try {
final realTimeSyncEnabled = await communicator.isEventSyncRealTimeEnabled();
if (realTimeSyncEnabled) {
print('Real-time sync active - immediate data updates');
// Show real-time indicator in UI
} else {
print('Batch sync active - periodic data updates');
// Show batch sync indicator
}
} catch (e) {
print('Failed to get sync setting: $e');
}
Throws:
Future.error("Unable to get event sync real time pref"): When retrieval fails
Use Cases:
- Updating UI sync status indicators
- Validating configuration state
- Settings screen initialization
- Performance monitoring and optimization
- Debugging data synchronization issues
Implementation
Future<bool> isEventSyncRealTimeEnabled() async {
try {
bool eventSyncRealTimeEnabled = await kruzr_comm
.isEventSyncRealTimeEnabled();
return eventSyncRealTimeEnabled;
} on Exception catch (e, stackTrace) {
if (kDebugMode) {
print("Error in isEventSyncRealTimeEnabled");
print(stackTrace);
print(e);
}
return Future.error("Unable to get event sync real time pref");
}
}