# SwiftInvoice Cross-platform offline-first invoice app for freelancers and tradespeople. Flutter/Dart, SQLite via Drift ORM, Riverpod state management, Material 3. ## Spec The full implementation plan, database schema, and feature specs live in `docs/SwiftInvoice_Implementation_Plan.md`. **Read it before writing any database or feature code.** It is the single source of truth for this project. ## Commands ```bash flutter pub get # Install dependencies flutter run # Run on connected device/emulator flutter test # Run all tests flutter analyze # Static analysis dart run build_runner build # Generate Drift code (run after any table change) dart format . # Format all Dart files ``` ## Coding Rules - Feature-first folder structure under `lib/features/`. Each feature owns its screens, widgets, and providers. - Drift table classes in `lib/core/database/tables/`, one file per table. DAOs in `lib/core/database/daos/`, one per entity. - No business logic in widgets. Put it in services or Riverpod providers. - Use `ConsumerWidget` / `ConsumerStatefulWidget` with Riverpod. No raw `setState` for shared state. - All monetary values are INTEGER cents. Tax rates are basis points (825 = 8.25%). Never use doubles for money. - All primary keys are TEXT UUIDs. All tables have `created_at` and `updated_at` ISO 8601 timestamps. - Prefer `const` constructors. Use named routes via GoRouter. ## Git Workflow - **Work on a feature branch.** Create a branch (`feat/feature-name`) for each feature or phase. Keep `main` clean. - **Commit in small increments.** One commit per logical unit: a single table, a single screen, a single service. Not one giant commit per feature. - **Use conventional commits:** `feat:`, `fix:`, `refactor:`, `test:`, `docs:`, `chore:` - **Merge to main only when a feature is complete**, tests pass, and `flutter analyze` is clean. - **Do not ask before committing, branching, or merging.** Just do it. ## Autonomous Execution - **Do not ask clarifying questions.** The implementation plan is the spec. If something is ambiguous, make a reasonable decision, leave a `// TODO:` comment, and keep going. - **Do not ask before running commands.** Run pub get, build_runner, tests, and analyze freely. - **Do not stop to present options or ask for preferences.** The tech stack and patterns are decided. - **Do not ask "should I continue?"** Always continue to the next task. - **If a test fails, fix it.** Only stop if you cannot resolve it after 3 attempts. - **If you need a dependency, add it to pubspec.yaml**, run pub get, and continue. ## Gotchas - Drift requires code generation — run `dart run build_runner build` after any table change or it won't compile. - The `pdf` package renders to its own widget tree, not Flutter widgets. They share syntax but are different libraries. - `flutter_local_notifications` needs platform-specific init in `MainActivity.kt` and `AppDelegate.swift`. - RevenueCat needs platform-specific setup in both `android/` and `ios/` — follow their Flutter quickstart. - Free tier limits (3 invoices/month, 2 clients) are enforced at the app layer, not the database.