๐Ÿ’ฐ Finance & Budgeting Services

18 services covering expense tracking, budgeting, debt management, investments, forecasting, and financial calculators โ€” all with offline-first local persistence.

Architecture pattern: All finance services use ServicePersistence (or extend CrudService) for JSON-serialized local storage. Data never leaves the device unless explicitly exported.
ServicePurposePersistence
ExpenseTrackerServiceTrack income & expenses with categories, payment methods, analyticsServicePersistence
BudgetPlannerServiceMonthly budgets with category allocation and variance trackingServicePersistence
SavingsGoalServiceNamed savings goals with contributions and progress trackingServicePersistence
DebtPayoffServiceDebt snowball/avalanche payoff planningCrudService
NetWorthTrackerServiceAsset & liability tracking with monthly snapshotsServicePersistence
FireCalculatorServiceFinancial independence / retire early projectionsStateless
ExpenseForecastServiceSpending anomaly detection and budget alertsStateless (reads expenses)
SubscriptionTrackerServiceRecurring subscription management with renewal calendarIn-memory list
BillReminderServiceBill tracking with due dates, autopay, and paid statusCrudService
CompoundInterestServiceCompound interest projections and Rule of 72Stateless
LoanCalculatorServiceAmortization schedules with extra payment analysisStateless
MortgageCalculatorServiceMortgage-specific calculations (extends loan logic)Stateless
TaxCalculatorServiceUS federal income tax with brackets and deductionsStateless
SalaryCalculatorServiceGross-to-net salary breakdown with tax withholdingStateless
InvoiceServiceInvoice generation with line items, tax, and discountStateless
CurrencyConverterServiceMulti-currency conversion with 30+ currenciesStateless
TipCalculatorServiceTip and bill splittingStateless

ExpenseTrackerService

The central expense tracking engine. Records income and expense transactions with categories, payment methods, tags, and notes. Provides daily summaries, category breakdowns, budget alerts, and streak tracking.

Key Types

enum ExpenseCategory { food, transport, housing, utilities, entertainment,
    shopping, health, education, travel, income, other }

enum PaymentMethod { cash, credit, debit, bankTransfer, digital, other }

class BudgetConfig {
  final double monthlyBudget;          // Default: 3000.0
  final Map<ExpenseCategory, double> categoryLimits;
  final double alertThreshold;          // 0.0โ€“1.0, default 0.8
  final String currencySymbol;
}

class DailyExpenseSummary {
  final DateTime date;
  final double totalSpent;
  final double totalIncome;
  final int transactionCount;
  final Map<ExpenseCategory, double> byCategory;
  final Map<PaymentMethod, double> byPaymentMethod;
  double get netFlow;                   // income - spending
}

Core Methods

MethodReturnsDescription
addExpense(ExpenseEntry)voidRecord a new transaction (income or expense)
removeExpense(String id)boolDelete a transaction by ID
updateExpense(ExpenseEntry)voidReplace an existing transaction
getExpensesByDateRange(start, end)List<ExpenseEntry>Filter entries within a date window
getDailySummary(DateTime)DailyExpenseSummaryAggregated daily spending breakdown
getMonthlySummary(year, month)MonthlySummaryMonth totals with category and payment method splits
updateBudget(BudgetConfig)voidSet monthly budget and category limits
getBudgetStatus()BudgetStatusCurrent spend vs budget with per-category progress

BudgetPlannerService

Monthly budget allocation with category-level caps. Compares planned budgets against actual spending from ExpenseTrackerService to surface variances and savings rates.

Core Methods

MethodReturnsDescription
setBudget(MonthlyBudget)MonthlyBudgetCreate or update a month's budget
getOrCreateBudget(year, month)MonthlyBudgetRetrieve existing or initialize from last month's template
deleteBudget(year, month)boolRemove a monthly budget
createEvenSplit(year, month, total)MonthlyBudgetAuto-allocate total evenly across all categories
getBudgetComparison(budget, expenses)BudgetComparisonPlanned vs actual with per-category variance
getSavingsRate(expenses, year, month)doubleSavings rate = (income โˆ’ spending) / income

SavingsGoalService

Named savings goals (vacation, emergency fund, etc.) with individual contribution tracking, progress percentages, and monthly savings insights.

Core Methods

MethodReturnsDescription
addGoal({name, target, deadline?})SavingsGoalCreate a new goal. Validates name and target > 0
addContribution(goalId, amount, note?)ContributionRecord money saved toward a goal
removeGoal(String id)boolDelete a goal and all its contributions
removeContribution(goalId, contribId)boolRemove a single contribution
monthlySavings(year, month)doubleTotal contributions for a given month
getInsights()SavingsInsightsAggregate stats: total saved, goal count, completion %
exportJson()StringFull JSON export for backup

DebtPayoffService

Debt management with payoff strategy simulation. Extends CrudService<DebtEntry> for CRUD operations and adds snowball/avalanche payoff planning.

Payoff Strategies

enum PayoffStrategy {
  snowball,    // Smallest balance first (behavioral motivation)
  avalanche,   // Highest interest rate first (mathematically optimal)
}

Core Methods

MethodReturnsDescription
addDebt({name, balance, rate, minPayment})DebtEntryAdd a debt. Validates rate โ‰ฅ 0 and minPayment > 0
removeDebt(String id)voidRemove a debt by ID
computePlan(strategy, {extraPayment})PayoffPlanSimulate month-by-month payoff with total interest and payoff date
PayoffPlan contains months (List of monthly snapshots), totalInterest, totalPaid, and payoffDate. Each monthly snapshot shows per-debt remaining balances and payments applied.

NetWorthTrackerService

Track assets and liabilities across accounts with monthly net worth snapshots, milestones, and category breakdowns.

Core Methods

MethodReturnsDescription
addAccount({name, type, balance})NetWorthAccountAdd an asset or liability account
archiveAccount(String id)boolSoft-delete an account (preserved in history)
restoreAccount(String id)boolUnarchive a previously archived account
updateBalance(id, newBalance)voidUpdate an account's current balance
takeSnapshot()MonthlyNetWorthRecord current total for historical tracking
getReport()NetWorthReportFull report with category breakdown and milestones

FireCalculatorService

Financial Independence / Retire Early (FIRE) calculator. Projects portfolio growth over time and estimates the year you can retire based on savings rate, investment returns, and withdrawal strategy.

Core Methods

MethodReturnsDescription
calculate({income, expenses, savings, returnRate, withdrawalRate, currentAge})FireResultFull FIRE projection with yearly portfolio values
savingsRateLabel(double rate)StringHuman-friendly label ("Excellent", "Good", etc.)

FireResult

class FireResult {
  final int yearsToFire;               // Years until financial independence
  final double fireNumber;             // Target portfolio value
  final double savingsRate;            // Annual savings as % of income
  final List<FireProjectionYear> projections;  // Year-by-year portfolio growth
}

Withdrawal Strategies

// Pre-defined withdrawal rates
WithdrawalStrategy.traditional  // 4% rule (Trinity Study)
WithdrawalStrategy.conservative // 3.5% (longer retirement horizon)
WithdrawalStrategy.lean         // 3% (lean FIRE)
WithdrawalStrategy.fat          // 4.5% (fat FIRE with margin)

ExpenseForecastService

Analyzes expense history to detect spending anomalies, identify recurring expenses, forecast upcoming costs, and generate budget alerts.

Core Methods

MethodReturnsDescription
generateReport(expenses, budgetConfig)ForecastReportComplete forecast with anomalies, alerts, recurring items, and per-category projections

ForecastReport Contents

class ForecastReport {
  final List<CategoryForecast> forecasts;       // Per-category projections
  final List<SpendingAnomaly> anomalies;         // Unusual spending spikes
  final List<RecurringExpense> recurring;         // Detected recurring charges
  final List<BudgetAlert> alerts;                // Budget threshold warnings
  final double projectedMonthlyTotal;
}

SubscriptionTrackerService

Manage recurring subscriptions with billing cycle tracking, renewal calendars, and spending breakdowns by category.

Core Methods

MethodReturnsDescription
add(SubscriptionEntry)voidAdd a subscription (throws on duplicate ID)
update(id, SubscriptionEntry)voidUpdate subscription details
remove(String id)voidCancel/remove a subscription
getSummary()SubscriptionSummaryTotal monthly/annual cost, count, category breakdown
getUpcomingBillings(days)List<BillingAlert>Subscriptions renewing within N days
getRenewalCalendar(month)List<RenewalCalendarEntry>Day-by-day renewal schedule for a month

BillReminderService

Track bills with due dates, autopay status, and payment confirmation. Extends CrudService<BillEntry>.

Core Methods

MethodReturnsDescription
addBill(BillEntry)voidAdd a new bill
markPaid(String id)voidMark a bill as paid for the current cycle
markUnpaid(String id)voidRevert a bill to unpaid
getSummary()BillSummaryUpcoming, overdue, and total monthly bill obligations

CompoundInterestService

Compound interest projections with configurable compounding frequencies. Stateless โ€” all methods are const-constructable and pure.

Compounding Frequencies

CompoundFrequency.annually     // 1ร—/year
CompoundFrequency.semiAnnually // 2ร—/year
CompoundFrequency.quarterly    // 4ร—/year
CompoundFrequency.monthly      // 12ร—/year
CompoundFrequency.daily        // 365ร—/year

Core Methods

MethodReturnsDescription
finalBalance({principal, rate, years, frequency, monthlyContrib})doubleFinal balance after compounding
yearsToReach({principal, target, rate, frequency, monthlyContrib})intYears needed to reach a target balance
ruleOf72(double annualRate)doubleApproximate doubling time (72 / rate)
getProjection({...})List<ProjectionPoint>Year-by-year projection with principal vs interest split

LoanCalculatorService

Loan amortization calculator with full payment schedules and extra-payment analysis. Shows interest savings from additional payments.

Core Methods

MethodReturnsDescription
calculate({principal, annualRate, months})LoanResultMonthly payment, total interest, amortization schedule
withExtraPayment({..., extraMonthly})ExtraPaymentResultCompares standard vs accelerated payoff โ€” months saved, interest saved

LoanResult

class LoanResult {
  final double monthlyPayment;
  final double totalInterest;
  final double totalPaid;
  final List<AmortizationEntry> schedule;  // Month-by-month principal/interest split
}

MortgageCalculatorService

Mortgage-specific calculator with property tax, PMI, HOA, and insurance factored into the monthly payment. Includes home affordability estimation.

Core Methods

MethodReturnsDescription
calculate({price, downPayment, rate, years, tax?, insurance?, pmi?, hoa?})MortgageResultFull monthly breakdown with PITI + HOA
affordability({income, debts, rate, years})doubleMaximum affordable home price (28/36 rule)

TaxCalculatorService

US federal income tax calculator with 2024 tax brackets, standard/itemized deductions, and filing status support.

Filing Statuses

FilingStatus.single
FilingStatus.marriedJoint
FilingStatus.marriedSeparate
FilingStatus.headOfHousehold

Core Methods

MethodReturnsDescription
calculate({income, filingStatus, deductions?})TaxResultTax owed, effective rate, marginal rate, bracket breakdown

TaxResult

class TaxResult {
  final double taxableIncome;
  final double totalTax;
  final double effectiveRate;           // totalTax / grossIncome
  final double marginalRate;            // Top bracket rate
  final List<BracketBreakdown> brackets; // Tax owed per bracket
}

SalaryCalculatorService

Gross-to-net salary calculator with federal tax withholding, FICA (Social Security + Medicare), and state tax estimation.

Core Methods

MethodReturnsDescription
calculate({grossAnnual, filingStatus, stateRate?, preTaxDeductions?})SalaryResultNet pay breakdown: federal, state, FICA, take-home per pay period

SalaryResult

class SalaryResult {
  final double grossAnnual;
  final double federalTax;
  final double stateTax;
  final double socialSecurity;
  final double medicare;
  final double netAnnual;
  final double netMonthly;
  final double netBiweekly;
}

InvoiceService

Invoice calculation engine with line items, quantity pricing, tax rates, and discount application.

Core Methods

MethodReturnsDescription
calculate({lineItems, taxRate?, discountPercent?})InvoiceResultSubtotal, discount amount, tax amount, and grand total

CurrencyConverterService

Offline currency converter with 30+ built-in exchange rates (pegged to USD). Rates are approximate โ€” intended for estimation, not trading.

Core Methods

MethodReturnsDescription
convert(amount, from, to)doubleConvert between any two supported currencies
getSupportedCurrencies()List<CurrencyInfo>All available currencies with name, symbol, and rate
Supported currencies include: USD, EUR, GBP, JPY, CAD, AUD, CHF, CNY, INR, BRL, MXN, KRW, SGD, HKD, SEK, NOK, DKK, NZD, ZAR, THB, and more.

TipCalculatorService

Simple tip calculator with bill splitting. Calculates tip amount, total per person, and supports custom tip percentages.

Core Methods

MethodReturnsDescription
calculate({billAmount, tipPercent, splitCount})TipResultTip amount, total, per-person share

Service Relationships

The finance services form a connected ecosystem:

ExpenseTrackerService โ”€โ”€โ†’ BudgetPlannerService  (actual vs planned)
         โ”‚                        โ”‚
         โ”œโ”€โ”€โ†’ ExpenseForecastService  (anomaly detection, projections)
         โ”‚
         โ””โ”€โ”€โ†’ SavingsGoalService  (track money set aside)
                    โ”‚
                    โ””โ”€โ”€โ†’ FireCalculatorService  (retirement projections)
                              โ”‚
CompoundInterestService โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  (investment growth math)

DebtPayoffService โ†โ”€โ”€โ†’ LoanCalculatorService  (shared amortization logic)
         โ”‚
MortgageCalculatorService  (extends loan concepts)

SubscriptionTrackerService โ”€โ”€โ†’ BillReminderService  (recurring obligations)

TaxCalculatorService โ”€โ”€โ†’ SalaryCalculatorService  (tax brackets shared)

InvoiceService, CurrencyConverterService, TipCalculatorService  (standalone utilities)

Last updated: April 2026 ยท GitHub