Local-First Flutter
Flutter can be a strong local-first app stack, but storage choices must match target platforms.
Local-First Shape
Widget/View
-> ViewModel
-> Repository
-> Local store
-> Export/backup/sync service
The local store should be the source of truth. Network sync, if present, should reconcile with the local source rather than making every UI read depend on the network.
Design Decisions
| Decision | Recommendation |
|---|---|
| Source of truth | Local database for records, not in-memory state |
| Migrations | Version and test before release |
| Export | Build before sync for user-owned data |
| Backup | Test restore on a clean install |
| Encryption | Define threat model and recovery before implementation |
| Sync | Add only when backup/export cannot solve the user problem |
| Conflicts | Model before writing sync code |
Cross-Platform Storage Risk
Mobile, desktop, and web do not share one identical storage substrate. A package may use SQLite on mobile, IndexedDB or Wasm-backed storage on web, and FFI/native libraries on desktop. Treat that as architecture.
Gotcha: A local-first app without restore tests is not durable. The data path must prove migration, export, backup, restore, and deletion.