sync_vault 0.0.3
sync_vault: ^0.0.3 copied to clipboard
An offline-first data synchronization layer for Flutter apps. Automatically queues API requests when offline and syncs with exponential backoff.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.0.3 - 2025-12-27 #
Added #
-
Event Bus System:
- New
SyncEventclass for tracking individual action lifecycles SyncEventStatusenum:queued,started,success,failed,deadLetterSyncVault.instance.onEventstream for listening to all eventsSyncVault.instance.eventsFor(id)for filtering events by action IDSyncVault.instance.eventsForKey(key)for filtering by idempotency key
- New
-
Flutter UI Widgets:
SyncVaultListener- Widget that listens to events and calls callbacksSyncStatusBuilder- Widget that rebuilds on sync status changesSyncEventBuilder- Widget that rebuilds on specific action events
Fixed #
- Race Condition: Worker now properly prevents duplicate executions when triggered by both "add action" and "network restore" events simultaneously
Changed #
- Worker now emits
SyncEventfor each action state change (started, success, failed, deadLetter) _handleDeadLettercallback now receives events through the event bus as well
0.0.2 - 2025-12-26 #
Added #
- SQLite Storage Adapter:
- New
SqfliteStorageAdapterclass for SQLite-based persistence - Full CRUD operations with proper JSON serialization for complex types
- Automatic schema creation with indexed timestamp column for FIFO ordering
- Custom database path support
- Schema migration support for future updates
- New
Dependencies #
- Added
sqflite: ^2.3.0- SQLite database support - Added
path: ^1.9.0- Path manipulation utilities
0.0.1 - 2025-12-25 #
Added #
-
Initial release of SyncVault
-
Core Features:
SyncVaultsingleton client for making offline-safe HTTP requestsSyncActionmodel for representing queued requestsStorageAdapterabstract interface for pluggable persistenceHiveStorageAdapterdefault implementation using HiveNetworkManagerfor connectivity monitoring viaconnectivity_plusWorkerfor queue processing with retry logic
-
HTTP Methods:
GET,POST,PUT,DELETE,PATCHsupport- Custom headers support
- Idempotency key support
-
Sync Features:
- Automatic sync on network restoration
- Manual sync trigger via
processQueue() - FIFO queue processing
- Exponential backoff with jitter
- Configurable max retries
- Dead letter handling for failed requests
-
Observability:
SyncStatusstream for UI updates- Pending action count
- Access to all pending actions
-
Example App:
- Complete Todo app demonstrating all features
- Beautiful dark UI with sync status indicators
- Optimistic UI updates
Architecture #
- Clean architecture with separated layers:
core/- Main business logic (SyncClient, Worker, NetworkManager)data/- Data models and storage (SyncAction, StorageAdapter)utils/- Utilities (Exceptions)
Dependencies #
dio: ^5.4.0- HTTP clienthive: ^2.2.3- Local persistenceconnectivity_plus: ^6.0.0- Network monitoringuuid: ^4.3.0- Unique ID generationequatable: ^2.0.5- Value equality