The model
A sinking fund is money put aside a little at a time for a bill you can see coming: car insurance, a holiday, a new laptop. Bide never touches real money. A fund is a label on money you already hold, and adding to it writes a record. Nothing is transferred.
Each fund has one or more cycles. A cycle is one saving period ending on a due date. One-off funds have a single cycle; recurring funds (monthly, quarterly, annual) start a new one after each due date is resolved as paid or not needed.
There is no account and no server. Everything is stored in an on-device Isar database. The network is used only for store purchases (RevenueCat) and anonymous product analytics, which can be switched off and never include names, notes or amounts.
Architecture
Layered, with dependencies pointing down. Blocs never see a repository; they call one use case per operation. Rules that need testing live in services with no Flutter or Isar imports.
One directory per screen with a Freezed Bloc (events and state). Routing via go_router with a stateful shell for the tab bar.
CreateFundUseCase, ResolveCycleUseCase, TransferBetweenFundsUseCase… each a thin invoke().
Pure Dart: plan calculator, months remaining, expected progress, fund status, notification planner, backup parser, CSV export. Unit-tested.
Interfaces with injectable implementations (get_it), one per aggregate.
One thin wrapper per external system: Isar, local notifications, home_widget, RevenueCat, Firebase Analytics, alternate app icons.
Money and dates
Integers only
Amounts are int minor units. The exponent comes from ISO 4217, so EUR has 2 decimals and JPY has 0. There is no double anywhere in the money path, and a single amount is capped at 10 million major units.
Dates without time
Due dates are calendar dates, not instants. A LocalDate value type holds year, month and day with no time zone. “Today” is re-read on resume and when the clock crosses midnight in the foreground.
Recurring dates clamp to the end of short months but remember their anchor day, so a bill on the 31st does not drift:
Jan 31 → Feb 28 → Mar 31 → Apr 30 // anchorDay = 31 is kept
Plan math
The plan works in whole calendar months. A month counts toward a cycle only if its first day is strictly before the due date, because the money has to be there on the day.
monthsRemaining(cycle, today):
count = 1 // this month always counts
m = firstOfMonth(today) + 1 month
while m < cycle.dueDate: count++, m += 1 month
return count
This month's requirement is computed against the balance at the start of the month, so adding money mid-month doesn't move the target. Each month rounds up and the last month takes the exact remainder, so the total never overshoots:
| €600 due in 7 months | Oct–Mar | Apr | Total |
|---|---|---|---|
| To the cent | 85.72 × 6 | 85.68 | 600.00 |
| Round to whole (default) | 86 × 6 | 84 | 600 |
When you are behind
A fund is only “behind” after a whole month has passed without enough saved, with 1% of the target as tolerance. The current month never counts against you until it ends. A shortfall is spread over the months that remain rather than added as a lump, and the UI says why the number went up: “€95 / mo, up from €75”.
expected = startAmount + (target − startAmount) × min(elapsed, total) / total
isBehind = expected − saved > ceil(target × 0.01)
The ledger
Every change is a transaction: add, withdraw, spent, transferIn, transferOut. Amounts are always positive; the type carries the sign. History is append-only. Corrections are new records, or an undo that deletes the latest action by its batchId (a transfer writes two records with one batch).
Saved amount, status, plan and free-to-spend are never stored. They are derived from the ledger on read, so they can't drift. The one invariant enforced on write is that a fund's balance never goes below zero.
saved(fund) = Σ signed(tx.amount)
freeToSpend = balance − Σ saved(fund ∉ archived) // may be negative; shown, not blocked
Widgets and reminders
Home-screen widgets are native on both platforms: three WidgetKit widgets in Swift and three AppWidgetProviders in Kotlin, including a per-fund widget with a configuration activity. Flutter builds a small snapshot (amounts already formatted) and writes it to shared storage through home_widget; the native side only draws.
A trigger watches Isar for any change, debounces it by 500 ms and rebuilds the snapshot. Notifications use the same pattern with a separate listener, so either pipeline can fail without taking down the other. The notification planner is a pure function from funds and settings to a list of planned notifications, and the whole schedule is replaced each time.
Backups and migrations
Every record carries a uuid next to its Isar id, so a JSON backup can be restored on another device and widgets can deep-link to a fund by a stable id. Funds and transactions also export to CSV.
Schema changes run as a linear chain of versioned migration steps before the first frame. Steps are never reordered or removed, so a device that skipped several versions still walks every one. If a step throws, the app opens a recovery screen that can still export a backup instead of starting on half-migrated data.
In numbers
- Dart source files
- 222
- Unit and widget tests
- 92
- Languages
- 3