Menu

Feature-first or layer-first? How to organize a Flutter project that will grow
📰

Feature-first or layer-first? How to organize a Flutter project that will grow

DEV Community: dart·Stacklyn Labs·about 8 hours ago
#uiQgowdk
#devtodart#devto#dev#feature#state
Long article (614 words) — no AI summary yet.
Reading 0:00
15s threshold

flutter create gives you a skeleton, not an architecture. The first decision that outlives every other one is how you organize your folders. There are two common answers.

Layer-first: group by technical role

lib/ models/ user.dart order.dart views/ login_page.dart orders_page.dart controllers/ auth_controller.dart orders_controller.dart

Enter fullscreen mode

Exit fullscreen mode

Everything of one kind lives together. It feels tidy with five screens.

Feature-first: group by what the app does

lib/ features/ authentication/ data/ state/ ui/ user_profile/ data/ state/ ui/ orders/ data/ state/ ui/ shared/

Enter fullscreen mode

Exit fullscreen mode

Each folder under features/ holds the UI, state and repository for one feature.

Why feature-first scales better

For large production apps, organizing by feature scales better than organizing by technical function. Three reasons from the source article:

It isolates domain logic.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.