getPendingFilesCount method

Future<num?> getPendingFilesCount()

Retrieves the number of files pending synchronization.

Returns the count of trip data files that are waiting to be uploaded to Kruzr servers.

Returns:

  • num?: Number of pending files, or null if unavailable

Usage:

try {
  final pendingCount = await communicator.getPendingFilesCount();
  if (pendingCount != null && pendingCount > 0) {
    print('$pendingCount files pending upload');
    // Show sync progress indicator
  } else {
    print('All files synchronized');
  }
} catch (e) {
  print('Failed to get pending files count: $e');
}

Throws:

  • Future.error("Unable to get files count"): When retrieval fails

Use Cases:

  • Displaying sync progress to users
  • Determining if sync is needed
  • Progress bar calculations

Implementation

Future<num?> getPendingFilesCount() async {
  try {
    return await kruzr_comm.getPendingFilesCount();
  } on Exception catch (e, stackTrace) {
    if (kDebugMode) {
      print("Error in getPendingFilesCount");
      print(stackTrace);
      print(e);
    }
    return Future.error("Unable to get files count");
  }
}