Getting Started with Flutter: Install, Your First App and Project Structure
A step-by-step guide from installing the Flutter SDK to running your first app and understanding the project structure, with tips that save you time at the start.
3 min read2 views
Flutter is Google's toolkit for building Android, iOS, web and desktop apps from one codebase, written in Dart. This guide takes you from installation to your first running app.
Flutter is a UI framework. Instead of wrapping the operating system's native widgets, it draws everything itself. The result is a consistent look and near-native performance on every platform.
Download the Flutter SDK from the official site and add its folder to your PATH.
Install Android Studio for the Android SDK and an emulator (or connect a real phone with USB debugging).
Run the command below and fix issues until everything is green:
flutter doctor
If the default servers are slow or blocked where you live, the PUB_HOSTED_URL and FLUTTER_STORAGE_BASE_URL environment variables let you use a trusted mirror.
These three lines generate a sample counter app and run it on the connected device. Open lib/main.dart. The smallest possible Flutter app looks like this:
Everything you see on screen is a widget: text, buttons, spacing, even the theme. Widgets come in two kinds: StatelessWidget for UI built from fixed input, and StatefulWidget for UI that changes over time (like a counter). You nest widgets to build the full interface.
After changing code, press r (or save in your IDE) and the change shows up in under a second without losing app state. R, or Hot Restart, restarts the app from scratch and is useful after you change your state structure.
Once your first app runs, learn three things: layout (Row, Column, Expanded), navigation between screens, and state management. Master those and you can build most real-world apps.
Choosing a state management approach is one of the first questions every Flutter developer faces. This article explains setState, Provider, Riverpod and Bloc with code and tells you which to choose for which project.
A good Flutter app should look great on a small phone, a tablet and a desktop window. Learn how to get there with LayoutBuilder, breakpoints, adaptive navigation and correct right-to-left support.
Good animation brings an app to life, but it has to be built the right way. This article covers implicit and explicit animations, Hero transitions and the performance tips that matter, with code.