Hay Vara? - Expense Tracker
Offline-first expense tracking across iOS, Android, and Web — built from a single Flutter codebase.
A cross-platform Flutter expense tracker with offline-first data and Clean Architecture — built as a production side project with a co-founder.
Challenges & Solutions
- 1 Challenge
Drift's mobile implementation relies on dart:io and a native SQLite file via NativeDatabase — neither exists in a browser. The data model and queries were platform-agnostic, but the connection layer wasn't: web required running SQLite as WASM, with Drift falling back between OPFS and IndexedDB depending on browser support. Connection setup also became async and more fragile — a misconfigured asset path or incomplete deploy could let the app boot with no working database at all.
SolutionIsolated the database connection behind a single factory function using Dart's conditional imports — resolving to a native file-based implementation on mobile and a WASM-based implementation on web, both exposed through the same AppDatabase contract. Repositories remain unaware of which implementation is active. Added logging to catch silent storage-fallback issues, and ensured WASM assets are correctly versioned and published as part of the Firebase Hosting build.
- 2 Challenge
The goal wasn't bidirectional sync — it was simpler: deciding what to show when the API is unreachable. Reads follow a network-first strategy, while writes (create/update/delete) require connectivity and fail outright when offline.
SolutionRather than building a sync queue or conflict resolution system, the app uses an implicit 'server wins' strategy on reconnect — the next successful read overwrites the local cache. A deliberate trade-off for an MVP: offline support covers read access while avoiding the complexity that full bidirectional sync would require.