getPendingFilesSize method
Retrieves the total size of files pending synchronization.
Returns the total size in bytes of trip data files waiting to be uploaded to Kruzr servers.
Returns:
num?: Total size in bytes of pending files, ornullif unavailable
Usage:
try {
final pendingSize = await communicator.getPendingFilesSize();
if (pendingSize != null && pendingSize > 0) {
final sizeInMB = pendingSize / (1024 * 1024);
print('${sizeInMB.toStringAsFixed(2)} MB pending upload');
}
} catch (e) {
print('Failed to get pending files size: $e');
}
Throws:
Future.error("Unable to get files size"): When retrieval fails
Use Cases:
- Estimating sync time and data usage
- Showing storage space information
- Determining sync priority based on data size
Implementation
Future<num?> getPendingFilesSize() async {
try {
return await kruzr_comm.getPendingFilesSize();
} on Exception catch (e, stackTrace) {
if (kDebugMode) {
print("Error in getPendingFilesSize");
print(stackTrace);
print(e);
}
return Future.error("Unable to get files size");
}
}