Create Your First Flutter App

Google Flutter 12 min min read Updated: Nov 16, 2026 Beginner
Create Your First Flutter App
Beginner Topic 3 of 5

Create the Project

bash flutter create my_first_app cd my_first_app flutter ru

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.

Naming rule: Project names use lowercase letters and underscores, such as 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 fileWhat 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.yamlProject settings, packages (dependencies) and assets such as images
analysis_options.yamlCode 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:

dart import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar(title: const Text('My First App')), body: const Center( child: Text('Hello, Flutter!', style: TextStyle(fontSize: 28)), ), ), ); } }

Understanding Every Part

CodeMeaning
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
StatelessWidgetA widget that does not change by itself
build(BuildContext context)Describes what the widget looks like
MaterialAppThe base of an app that uses Material Design: theme, navigation, title
ScaffoldA basic page layout with app bar, body and more
AppBarThe top bar
CenterPlaces its child in the middle
TextShows text

The Widget Tree

text MyApp └── MaterialApp └── Scaffold ├── AppBar │ └── Text('My First App') └── Center └── Text('Hello, Flutter!')

Flutter apps are trees of widgets. Each widget has a parent and can have children.

Try It Yourself

  1. Change the text to your name.
  2. Change fontSize to 40.
  3. Add color: Colors.blue inside TextStyle.
  4. Change the app bar title.
What is 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.

Quick Summary: flutter create makes the project, lib/main.dart is the start, runApp shows the root widget and MaterialApp plus Scaffold give a page.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators