Sync Service
Component Detail
Service Layer
high complexity
mobile
4
Dependencies
3
Dependents
4
Entities
0
Integrations
Description
Core orchestration service responsible for reconciling locally queued mutations with the backend REST API when connectivity is restored. Processes the offline queue in FIFO order with exponential backoff on failure, emits sync lifecycle events consumed by UI state managers, and coordinates with the conflict resolution strategy. Triggered on app foreground and connectivity-restored events.
sync-service
Responsibilities
- Drain the offline queue in FIFO order on connectivity restore or app foreground
- Apply exponential backoff and retry logic for failed sync operations
- Emit sync lifecycle events (started, progress, completed, failed) to Bloc/Riverpod streams
- Coordinate conflict resolution using server-wins strategy
- Maintain audit trail of resolved conflicts in local database
Interfaces
startSync()
stopSync()
getSyncStatus(): SyncStatus
getSyncStream(): Stream<SyncState>
processQueue()
retryFailedOperations()
getLastSyncedAt(): DateTime?
getPendingOperationCount(): int
cancelPendingSync()
forceSyncNow()
Relationships
Dependencies (4)
Components this component depends on
Dependents (3)
Components that depend on this component
Related Data Entities (4)
Data entities managed by this component