Skip to Content

Flutter

Flutter is Google’s open-source UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase using the Dart language.

Core Concepts

Widgets

Everything in Flutter is a widget. Widgets describe what their view should look like given their current configuration and state.

  • StatelessWidget β€” immutable, rebuilt only when parent changes
  • StatefulWidget β€” mutable state, can trigger rebuilds via setState()

The Widget Tree

MaterialApp └── Scaffold β”œβ”€β”€ AppBar └── body: Column β”œβ”€β”€ Text('Hello') └── ElevatedButton(...)

State Management

ApproachBest For
setStateLocal, simple widget state
ProviderApp-wide state, simple DI
RiverpodScalable, testable state (recommended)
Bloc/CubitComplex business logic separation
lib/ β”œβ”€β”€ main.dart β”œβ”€β”€ app.dart β”œβ”€β”€ features/ β”‚ └── auth/ β”‚ β”œβ”€β”€ data/ β”‚ β”œβ”€β”€ domain/ β”‚ └── presentation/ β”œβ”€β”€ shared/ β”‚ β”œβ”€β”€ widgets/ β”‚ └── theme/ └── core/ β”œβ”€β”€ router/ └── services/

References

Last updated on