How to Create Your First Flutter App - Hello World in 10 Minutes

Introduction

Do you want to build your first mobile app but you do not know where to start? This guide is for you. In this article, you will learn how to create your first Flutter app step by step. You will build a simple Hello World app and run it on your computer in about 10 minutes.

This guide is for complete beginners. You do not need past app development experience. You only need Flutter already installed on your Windows laptop. If Flutter is not installed yet, first read our guide on how to install Flutter and Android Studio on Windows 11, then come back here.

What You Will Learn

  • What a Flutter app project looks like
  • How to create a new Flutter project with one command
  • How to understand the main code file
  • How to change the text to Hello World
  • How to run your app on an emulator or a real phone
  • How to fix the most common first-time problems

What You Need Before You Start

Before you create your first app, check these three things:

  • Flutter is installed. Open a terminal or command prompt and type flutter doctor. If Flutter shows no major errors, you are ready.
  • A code editor is ready. You can use Android Studio or VS Code. Both work well for Flutter.
  • An emulator or a phone is ready. You can run your app on an Android emulator in Android Studio, or on your own Android phone with USB debugging turned on.

If any of these steps is missing, install Flutter and Android Studio first. Do not skip this check, because most first-app errors come from an incomplete setup.

Beginner creating a first Flutter app on a laptop


Step 1: Open Your Terminal

First, open a terminal or command prompt on your Windows laptop. Choose a folder where you want to save your projects. For example, you can create a folder named Flutter Projects on your Desktop or in your Documents folder.

Move into that folder in the terminal. This keeps all your app projects in one clean place, so you can find them easily later.

Step 2: Create a New Flutter Project

Now create your first project with one simple command. Type this command and press Enter:

flutter create hello_world_app

This command does three things for you:

  1. It creates a new folder named hello_world_app.
  2. It adds all the basic files a Flutter app needs.
  3. It adds a ready-made sample app that you can change and learn from.

Wait for the command to finish. It may take one or two minutes the first time. When it says that the project was created, move into the new folder with this command:

cd hello_world_app

Steps to create a new Flutter project in a code editor


Step 3: Open the Project in Your Editor

Now open the project folder in Android Studio or VS Code. In VS Code, you can type code . in the terminal. In Android Studio, use File and then Open, and select the hello_world_app folder.

Inside the project, you will see folders like lib, android, ios, and web. For now, focus only on the lib folder. This folder holds your Dart code. The most important file inside it is main.dart. This file is the starting point of your app.

Step 4: Understand the Main Code File

Open lib/main.dart in your editor. At first, the code may look long, but do not worry. You only need to understand a few simple parts:

  • The main function starts your app. It tells Flutter which widget to show first.
  • MaterialApp gives your app a basic design, with a title bar and a clean layout.
  • Scaffold gives your app a screen structure, with a body where you can place text, buttons, and images.
  • Text widget shows words on the screen. This is where your Hello World message will go.

Flutter builds an app from small building blocks called widgets. A Text widget shows text. A Center widget places its child in the middle of the screen. When you understand these two widgets, the Hello World app becomes very easy.

Step 5: Change the Code to Hello World

Now replace the sample code with a short and simple Hello World app. Delete the old code in main.dart and write this code instead:

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 World',
            style: TextStyle(fontSize: 30),
          ),
        ),
      ),
    );
  }
}

Here is what this code does, line by line:

  • It imports the Flutter material design library, which gives you ready-made design widgets.
  • The main function runs the MyApp widget.
  • MaterialApp sets up the app.
  • Scaffold builds the screen.
  • AppBar shows a top bar with the title My First App.
  • Center places the text in the middle of the screen.
  • Text shows the words Hello World in a large size.

Save the file after you write this code. Saving is important, because Flutter runs the saved version of your code.

Step 6: Run Your First App

Now it is time to see your app running. First, start an Android emulator from Android Studio, or connect your Android phone to your laptop with a USB cable. Then, in the terminal, type this command:

flutter run

Flutter will build your app and install it on the emulator or phone. This can take a few minutes the first time. When it finishes, you should see a screen with a top bar that says My First App and the words Hello World in the middle of the screen.

Congratulations. You have just created and run your first Flutter app.

Hello World app running on a phone emulator


Try It Yourself: Change the Message

Now try a small change on your own. This is the best way to learn Flutter:

  1. Change the words Hello World to Hello, I am learning Flutter.
  2. Save the file.
  3. Press r in the terminal for hot reload, or press the hot reload button in your editor.

Hot reload updates your running app in seconds, without restarting it fully. You will see your new message on the screen at once. Try changing the font size from 30 to 40 and watch the text grow. Small experiments like this build real confidence.

Common Problems and Simple Fixes

Flutter command is not recognized

If the terminal says that flutter is not recognized, Flutter is not added to your system path, or you opened the terminal in the wrong place. Close the terminal, open the Flutter folder, and check the installation steps again. Then run flutter doctor to confirm the setup.

No device found

If Flutter says that no device is connected, check two things. First, make sure an emulator is running, or your phone is connected and USB debugging is turned on. Second, run flutter devices in the terminal. This command lists all devices Flutter can see. If your device is not listed, restart the emulator or reconnect your phone.

The app takes a long time to build

The first build is always slow, because Flutter downloads and prepares many files. Wait patiently and do not close the terminal. Later builds are much faster. If your laptop is slow, close extra programs and browser tabs before you run the app.

Red error text in the code

A red underline or error message usually means a small typing mistake, such as a missing comma, bracket, or semicolon. Read the error message slowly. It often tells you the line number. Compare that line with the code in this article and fix the missing symbol.

Beginner fixing a small error and running a Flutter app successfully


Tips for Beginners

  • Build small apps first. A Hello World app, a counter app, and a simple list app teach you more than one large unfinished project.
  • Change one thing at a time. If you change many things at once and an error appears, you will not know which change caused it.
  • Read error messages slowly. Error messages look scary at first, but they usually point to the exact problem.
  • Practice hot reload daily. Fast feedback keeps learning fun and helps you understand how each widget works.
  • Keep your projects organized. Use one main folder for Flutter projects and clear names for each app.

Conclusion

You have now learned how to create your first Flutter app. You created a new project with flutter create, you understood the main code file, you changed the code to show Hello World, and you ran the app on a device. That is a real first step in mobile app development.

Your next step is simple. Change the text, add a button, or change the colors, and run the app again. Each small change teaches you something new. Keep building, keep practicing, and your skills will grow step by step.

Related article: If you have not installed Flutter yet, read How to Install Flutter and Android Studio on Windows 11 - Complete Guide for Beginners on this blog before your next project.

FAQs

Do I need to know Dart before I learn Flutter?

No, you can learn Dart and Flutter together. The Hello World app uses only a few simple Dart ideas, and you will learn more Dart naturally as you build more apps.

Can I create a Flutter app on Windows?

Yes. You can create and run Android apps with Flutter on Windows. You need Flutter, Android Studio, and an Android emulator or an Android phone.

How long does it take to create a Hello World app in Flutter?

Once Flutter is installed, creating the project and changing the code takes about 10 minutes. The first run can take a few extra minutes while Flutter builds the app for the first time.

Why is my first app not running?

The most common reasons are an incomplete Flutter setup, no emulator or phone connected, or a small typing error in the code. Run flutter doctor and flutter devices to check your setup, then read the error message carefully.

What should I learn after Hello World?

After Hello World, learn buttons, images, and simple layouts. Then build a small counter app and a simple to-do list app. These projects teach you the core Flutter widgets step by step.

By Techmithu

Comments

Popular posts from this blog

How to Install Flutter and Android Studio on Windows 11 - Complete Guide for Beginners

How to Make Your Laptop Battery Last Longer

Laptop Course for Beginners - Complete Guide in Simple Words