syncPending method
Push all pending local changes to the remote data source.
Processes records with SyncStatus.pending only.
Does NOT retry SyncStatus.failed records — use syncFailed for that.
Uses batching and retry with exponential backoff.
Respects cancelToken for cancellation.
Implementation
@override
Future<void> syncPending({CancelToken? cancelToken}) async {
// Gather only pending (fresh, never-failed) records.
// Failed records are not retried here — use [syncFailed] for that.
final pendingKeys = await _metadataStore.getKeysByStatus(
SyncStatus.pending,
);
if (pendingKeys.isEmpty) {
logger.fine('No pending records to sync');
return;
}
logger.info('Syncing ${pendingKeys.length} pending records');
await _processKeys(pendingKeys, cancelToken);
}