Clean Architecture, deep dive
The why behind every layer
Most Flutter apps start simple and end tangled: widgets that own HTTP calls, models that drive UI, business rules that live in `initState`. Clean Architecture is the discipline of giving each of those jobs its own home and putting walls between the homes so they can't accidentally call each other. By the end of this chapter you'll be able to look at any line in `lib/` and say: 'this is here because of principle X.'
Why
The problem CA solves
The problem CA actually solves
The fat-widget trap
The Rule
Dependencies inward, always
The dependency rule
One law, three letters
Three Layers
Domain · Data · Presentation
Domain — what the app does
Entities · Repo contracts · Use cases
Data — how the app gets and stores things
Models · Data sources · Repo impl
Presentation — showing the user
Cubits · States · Widgets
Boundary
Composition + verdict
The composition root
main.dart + service_locator.dart
What CA gives you, concretely
And when it's overkill
Sections
· click any card to expandApple Pencil draws with pressure. Fingers still scroll. Saved per pillar.