Here’s a comprehensive list of flutter commands with examples. Flutter is a popular open-source UI software development kit created by Google for building natively compiled applications for mobile, web, and desktop platforms from a single codebase.
Table of Contents
Flutter analyze – analyze Flutter Commands
Analyze the project’s Dart code.
flutter analyze
Flutter build – build Flutter Commands
Builds the Flutter project for the target platform.
flutter build apk # For Android<br>flutter build ios # For iOS<br>flutter build web # For Web
Flutter channel – to check stable channel
Lists or switches Flutter channels.
flutter channel # List available channels<br>flutter channel stable # Switch to stable channel
Flutter clean – clean flutter commands
Deletes the build/ and .dart_tool/ directories.
flutter clean
Flutter config
Configures Flutter settings.
flutter config --enable-web
Flutter create
Creates a new Flutter project.
flutter create my_app
Flutter devices
Lists all connected devices.
flutter devices
Flutter doctor
Check if your system is set up for Flutter development.
flutter doctor
Flutter downgrade
Downgrades Flutter to the last active version for the current channel.
flutter downgrade
Flutter drive
Runs an integration test on an attached device or emulator.
flutter drive --target=test_driver/app.dart
Flutter emulators
Lists, launches, and creates emulators.
flutter emulators<br>flutter emulators --launch Pixel_3a_API_30_x86
Flutter format
Formats Dart source code.
flutter format .
Flutter gen-l10n
Generates localization files.
flutter gen-l10n
Flutter install
Installs a Flutter app on an attached device.
flutter install
Flutter logs
Shows log output for running Flutter apps.
flutter logs
Flutter pub
Works with packages.
flutter pub get # Gets packages<br>flutter pub outdated # Checks for outdated packages<br>flutter pub upgrade # Upgrades packages
Flutter run
Runs your Flutter app on an attached device or emulator.
flutter run<br>flutter run --release # Run in release mode
Flutter screenshot
Takes a screenshot from a connected device.
flutter screenshot
Flutter test
Runs unit tests for the current project.
flutter test
Flutter upgrade
Upgrade your copy of Flutter.
flutter upgrade
Flutter version
Shows which version of Flutter you’re using.
flutter version
Flutter packages
The deprecated command for working with packages (use flutter pub
instead).
flutter packages get
Remember that you can always use flutter help [command]
to get more information about a specific command. For example:
flutter help create
This will give you detailed information about the flutter create
command and its options.
Also Read:
Flutter Commands FAQs
How to run Flutter commands in Android Studio?
To run Flutter commands in Android Studio:
Open your Flutter project in Android Studio.
Go to View > Tool Windows > Terminal (or press Alt+F12).
In the terminal window that appears at the bottom of the IDE, you can now run Flutter commands.1
For example, to run your app:flutter run
You can also use Android Studio’s UI for many common Flutter tasks:
To run your app, click the ‘Run’ button (green play icon) in the toolbar.
To get packages, go to Tools > Flutter > Pub Get.
To upgrade Flutter, go to Tools > Flutter > Flutter Upgrade.
Cannot run Flutter on command prompt. What should I do?
If you’re unable to run Flutter commands in the command prompt, try these steps:
Ensure Flutter is properly installed and added to your system’s PATH.
Open a new command prompt window (changes to PATH may require a restart).
Run flutter doctor
Check for any issues with your Flutter installation.
If the issue persists, try the following:
Reinstall Flutter and carefully follow the official installation guide.
Check your system’s environment variables and ensure the Flutter bin directory is in the PATH.
Try running the command with the full path to the Flutter executable.
If you still encounter issues, check the Flutter GitHub issues or seek help on the Flutter community forums.
How do you create a Flutter app using the command line?
To create a new Flutter app using the command line:
Open your terminal or command prompt.
Navigate to the directory where you want to create your project.
Run the following command:flutter create my_app
Replace my_app
with your desired project name.
Once the command completes, you’ll have a new Flutter project in a directory named my_app
.
To run your new app:
Navigate into the project directory:cd my_app
Run the app:flutter run
How do you run Flutter commands?
To run Flutter commands:
Open a terminal or command prompt.
Ensure you’re in your Flutter project directory (if running project-specific commands).
Type flutter
followed by the command you want to run.
Examples:
To check your Flutter installation: flutter doctor
To run your app: flutter run
To get packages: flutter pub get
Make sure Flutter is properly installed and added to your system’s PATH. If you’re having trouble, refer to the answer for Q2 in this FAQ.
What does [] mean in Flutter command help?
A: In Flutter command help documentation, square brackets []
typically indicate optional parameters or arguments.
For example, in the command:flutter run [-d <device-id>]
The -d <device-id>
part is in square brackets, meaning it’s optional. You can run the command without specifying a device ID, and Flutter will use the default or only available device.
Similarly, in command descriptions:<>
angle brackets usually indicate a placeholder that you should replace with an actual value.|
vertical bars often mean “or”, indicating you should choose one of the options.