Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Flutter CLI and First Run | Flutter Basics
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Flutter App Foundations

bookFlutter CLI and First Run

Flutter command-line interface (CLI) is used to set up and manage your first Flutter app project.

  • Run flutter doctor to check your environment and confirm all requirements are met;
  • Use flutter create to generate a new Flutter app from the terminal;
  • Launch and debug your app using flutter run.

Mastering these tools will help you quickly start, test, and troubleshoot Flutter projects directly from your terminal.

The flutter doctor Command

The flutter doctor command checks your development environment for any missing dependencies or configuration issues. It ensures that your system is ready to build and run Flutter apps.

When you run flutter doctor, you receive a summary of your setup, including:

  • Operating system details;
  • Flutter SDK version;
  • Dart SDK version;
  • Android toolchain status (including Android Studio and required SDKs);
  • iOS toolchain status (if you are on macOS);
  • Connected devices (such as emulators or physical devices).
12
# Run the Flutter Doctor command to check your environment flutter doctor
copy

Creating a New Flutter App

The flutter create command helps you quickly set up a new Flutter project from the terminal. This command generates all the necessary files and folders you need to start building your app. To create a new Flutter app:

  • Open your terminal;
  • Navigate to the directory where you want your project to be created;
  • Run the following command, replacing my_app with your desired project name:
flutter create my_app

This command will create a new directory called my_app containing a complete Flutter project structure. You can then move into your project folder:

cd my_app

Your new app is now ready for development. The main entry point is the lib/main.dart file. You can open this file in your code editor to start customizing your app.

12345678
# Create a new Flutter project named my_first_app flutter create my_first_app # Change directory into the new project folder cd my_first_app # List the files in the new project ls
copy

Running Your App

The flutter run command lets you launch your Flutter app directly from the terminal. This is useful for quickly testing changes and seeing your app in action on a connected device or emulator.

  • Open your terminal and navigate to your Flutter project directory;
  • Make sure you have a device connected or an emulator running;
  • Enter flutter run and press Enter.
12
# Make sure you are in the root directory of your Flutter project flutter run
copy
question mark

What is the primary purpose of the flutter doctor command?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

bookFlutter CLI and First Run

Swipe to show menu

Flutter command-line interface (CLI) is used to set up and manage your first Flutter app project.

  • Run flutter doctor to check your environment and confirm all requirements are met;
  • Use flutter create to generate a new Flutter app from the terminal;
  • Launch and debug your app using flutter run.

Mastering these tools will help you quickly start, test, and troubleshoot Flutter projects directly from your terminal.

The flutter doctor Command

The flutter doctor command checks your development environment for any missing dependencies or configuration issues. It ensures that your system is ready to build and run Flutter apps.

When you run flutter doctor, you receive a summary of your setup, including:

  • Operating system details;
  • Flutter SDK version;
  • Dart SDK version;
  • Android toolchain status (including Android Studio and required SDKs);
  • iOS toolchain status (if you are on macOS);
  • Connected devices (such as emulators or physical devices).
12
# Run the Flutter Doctor command to check your environment flutter doctor
copy

Creating a New Flutter App

The flutter create command helps you quickly set up a new Flutter project from the terminal. This command generates all the necessary files and folders you need to start building your app. To create a new Flutter app:

  • Open your terminal;
  • Navigate to the directory where you want your project to be created;
  • Run the following command, replacing my_app with your desired project name:
flutter create my_app

This command will create a new directory called my_app containing a complete Flutter project structure. You can then move into your project folder:

cd my_app

Your new app is now ready for development. The main entry point is the lib/main.dart file. You can open this file in your code editor to start customizing your app.

12345678
# Create a new Flutter project named my_first_app flutter create my_first_app # Change directory into the new project folder cd my_first_app # List the files in the new project ls
copy

Running Your App

The flutter run command lets you launch your Flutter app directly from the terminal. This is useful for quickly testing changes and seeing your app in action on a connected device or emulator.

  • Open your terminal and navigate to your Flutter project directory;
  • Make sure you have a device connected or an emulator running;
  • Enter flutter run and press Enter.
12
# Make sure you are in the root directory of your Flutter project flutter run
copy
question mark

What is the primary purpose of the flutter doctor command?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 3
some-alt