App Architecture Ladder

Use the smallest structure that still makes change safe. Flutter’s official app architecture guidance is useful, but applying the full shape to a tiny app creates ceremony before it creates value.

Ladder

StageUse whenShape
1. Single screenPrototype, demo, throwaway UImain.dart, a few widgets, local state
2. Feature foldersMore than one screen or flowfeatures/<feature>/, reusable widgets, route names
3. UI plus dataApp reads/writes storage or networkViews call view models, view models call repositories
4. MVVM per featureScreens have non-trivial state and commandsView plus view model per feature, immutable UI state
5. Domain layerBusiness rules span repositories or use casesUse cases/interactors between view models and repositories
6. Multi-package appMultiple teams, shared modules, plugin packagesPackage boundaries, published APIs, stricter CI

Start at stage 2 or 3 for real apps:

lib/
  main.dart
  app.dart
  routing.dart
  features/
    expenses/
      expenses_view.dart
      expenses_view_model.dart
      expenses_repository.dart
  services/
    local_database.dart
    platform_notifications.dart
test/
  features/
    expenses/
      expenses_view_model_test.dart
      expenses_view_test.dart

This is enough to keep widgets light without inventing packages, modules, or an abstract domain layer before the app earns them.

Rules

RuleWhy
Keep business logic out of widgetsWidget tests stay focused and logic gets unit tests
Let view models expose UI state and commandsViews remain declarative and easy to rebuild
Put persistence/network/platform access behind repositories or servicesTests can fake dependencies and platform changes stay localized
Add domain/use-case classes only for repeated business rulesAvoid a folder full of pass-through wrappers
Wire dependencies manually firstDependency injection packages are useful only after object graphs hurt

Gotcha: A features/, domain/, data/, core/, and shared/ tree does not make an app maintainable by itself. The dependencies and tests matter more than folder names.