Architecture Flutter Interview Questions
8 questions
What is Clean Architecture and how does it apply to Flutter?
Clean Architecture separates an app into independent layers — typically presentation, domain, and data — where inner layers (business logic) never depend on outer layers (UI, frameworks, databases), so business rules can be tested and reused independently of Flutter itself.
What is the Repository pattern?
The Repository pattern puts a single abstraction in front of however data is actually fetched or stored — network, local cache, database — so the rest of the app talks to one consistent interface and doesn't care where the data comes from.
What is Dependency Injection and how is it used in Flutter?
Dependency Injection means a class receives its dependencies from the outside (via constructor or a container) instead of creating them itself, which decouples classes from concrete implementations and makes them easy to test with substitutes.
How do SOLID principles apply to Flutter development?
SOLID principles apply the same way they do in any OOP codebase — widgets, repositories, and use cases are the concrete places you apply them: single-responsibility widgets, interfaces for repositories (dependency inversion), and small, focused classes over sprawling ones.
How does MVVM compare to Clean Architecture in Flutter?
MVVM (Model-View-ViewModel) is primarily about separating presentation logic from UI; Clean Architecture is a broader, layered approach that MVVM can actually live inside as the presentation layer's specific pattern.
Feature-first vs layer-first folder structure — which is better for a Flutter project?
Layer-first (grouping by technical layer) works fine for small apps; feature-first (grouping by feature, each containing its own presentation/domain/data) scales much better as an app grows, since related code stays together.
What is a Use Case in Clean Architecture and is it always necessary?
A Use Case represents a single, specific business action, sitting in the domain layer and orchestrating one or more repository calls; it's most valuable when business logic is genuinely complex, and can be overkill for simple CRUD-style operations.
What's the difference between a DTO, a Model, and an Entity in Clean Architecture?
An Entity is a pure business object living in the domain layer with no knowledge of JSON or databases; a Model (or DTO) lives in the data layer, knows how to (de)serialize from a specific data source, and gets converted into an Entity before crossing into the domain layer.