The problem
Users expect apps to keep working on a train, in a lift, or on flaky rural networks. Offline-first treats the local store as the source of truth and syncs in the background.
The setup
- Hive holds the local cache and a pending-writes queue.
- BLoC emits optimistic UI updates the moment a user acts.
- A sync worker drains the queue when connectivity returns.
Reconciliation
Stamp each record with an updated-at timestamp and let the most recent write win. It is simple, predictable, and good enough for the vast majority of mobile use-cases.
