Flutter Terminal Commands Guide

1. Go to Your Flutter Project

cd path/to/your/flutter_project

Changes the terminal’s current folder to your Flutter project directory.


2. Check Flutter Installation

flutter doctor

Verifies that Flutter, Dart, Android Studio, Xcode, and other required tools are installed correctly.


3. Get Packages

flutter pub get

Downloads and installs all dependencies listed in your pubspec.yaml file.


4. See Available Devices

flutter devices

Lists all connected devices and emulators that can run your Flutter app.


5. Run the App

flutter run

Builds and launches the application on the default available device.

Run on a Specific Device

flutter run -d <device_id>

Runs the application on a selected device instead of the default one.

Run on macOS

flutter run -d macos

Launches the Flutter application as a native macOS desktop app.

Run in Google Chrome

flutter run -d chrome

Runs the application as a web app inside Google Chrome.

Run in Microsoft Edge (Windows)

flutter run -d edge

Runs the Flutter web application in Microsoft Edge.

Run in Safari (macOS)

Flutter does not directly support Safari.

flutter run -d web-server

Starts a local web server and provides a URL that can be opened in Safari.

Then open the displayed URL, such as:

http://localhost:8080

Useful Commands

Hot Reload

r

Applies code changes instantly while preserving the application’s current state.

Hot Restart

R

Restarts the Flutter application and reloads all code from scratch.

Quit

q

Stops the running Flutter application and exits the debug session.


Clean Project

flutter clean
flutter pub get

Removes old build files and downloads fresh dependencies to fix many project issues.


Build macOS App

flutter build macos

Creates a release-ready macOS desktop application.


Build Android APK

flutter build apk

Generates an Android APK file for direct installation or testing.


Build Android App Bundle (Google Play)

flutter build appbundle

Creates an AAB file optimized for publishing on the Google Play Store.


Build iOS App

flutter build ios

Generates an iOS build that can be opened in Xcode for App Store submission.


Build Web App (PWA / Web Application)

flutter build web

Creates optimized HTML, JavaScript, and asset files for website deployment.

The generated files are stored in:

build/web

Serve the Built Web App Locally

python3 -m http.server 8000 --directory build/web

Starts a lightweight local web server to preview the production web build.

Then open:

http://localhost:8000

in Chrome, Edge, Safari, or another browser.


Check Flutter Version

flutter --version

Displays the installed Flutter and Dart versions.


Upgrade Flutter

flutter upgrade

Updates Flutter to the latest stable release.


View Connected Emulators

flutter emulators

Shows all available Android and iOS emulators installed on your system.


Analyze Project

flutter analyze

Checks your code for errors, warnings, and best-practice issues.


Run Tests

flutter test

Executes all unit and widget tests in the project.


Upgrade Dependencies

flutter pub upgrade

Updates project dependencies to newer compatible versions.


Benefits of Deploying Flutter Applications

One of Flutter’s greatest strengths is the ability to deploy the same codebase to Web, iOS, Android, and Desktop platforms.

Web (PWA / Web Application)

  • Users can access the application instantly through a browser.
  • No installation is required.
  • Easy to share through a URL.
  • Ideal for business websites, dashboards, SaaS platforms, and customer portals.
  • Lower deployment and maintenance costs.

iOS

  • Access to Apple’s App Store ecosystem.
  • Reaches iPhone and iPad users worldwide.
  • Strong user engagement and premium audience.
  • Supports Apple services such as Apple Pay and Sign in with Apple.
  • Delivers a native, high-performance user experience.

Android

  • Access to the world’s largest mobile platform.
  • Reach billions of users through Google Play.
  • Supports a wide range of devices and price points.
  • Easy distribution and testing.
  • Strong integration with Google services and APIs.

Why Flutter?

Instead of maintaining separate projects for Web, iOS, and Android, Flutter allows developers to build all platforms from a single codebase. This reduces development costs, speeds up releases, simplifies maintenance, and provides a consistent user experience across devices.