Create the Project
flutter create makes a complete starter project. flutter run builds it and starts it on your device. If several devices are available, Flutter asks you to choose one.
my_first_app. No spaces, capital letters or dashes.
The Starter App
You will see a counter app with a button. Tap the plus button and the number goes up. It is a small app, but it shows the main ideas of Flutter.
Project Folder Structure
| Folder or file | What it is for |
|---|---|
lib/ | All your Dart code lives here. Start with lib/main.dart |
android/, ios/, web/, windows/ ... | Platform-specific projects. You rarely edit these at the start |
test/ | Automated tests |
pubspec.yaml | Project settings, packages (dependencies) and assets such as images |
analysis_options.yaml | Code style and lint rules |
.dart_tool/, build/ | Generated files. Do not edit them |
Your Smallest Flutter App
Replace everything in lib/main.dart with this tiny app:
Understanding Every Part
| Code | Meaning |
|---|---|
import 'package:flutter/material.dart'; | Brings in Flutter's Material widgets |
void main() | Every Dart program starts here |
runApp(...) | Puts a widget on the screen as the root of the app |
StatelessWidget | A widget that does not change by itself |
build(BuildContext context) | Describes what the widget looks like |
MaterialApp | The base of an app that uses Material Design: theme, navigation, title |
Scaffold | A basic page layout with app bar, body and more |
AppBar | The top bar |
Center | Places its child in the middle |
Text | Shows text |
The Widget Tree
Flutter apps are trees of widgets. Each widget has a parent and can have children.
Try It Yourself
- Change the text to your name.
- Change
fontSizeto 40. - Add
color: Colors.blueinsideTextStyle. - Change the app bar title.
const? const tells Dart that the widget never changes, so Flutter can reuse it and save work. Add it whenever the analyzer suggests it.
Conclusion
You created and ran a Flutter app and read every line of it. The pattern of runApp, MaterialApp and Scaffold is the start of almost every Flutter project.

