flutter
Build, test, and deploy Flutter applications
TLDR
Initialize a new Flutter project in a directory of the same name
Check if all external tools are correctly installed
List or change Flutter channel
Run Flutter on all started emulators and connected devices
Run tests in a terminal from the root of the project
Build a release APK targeting most modern smartphones
Delete the build and .dart_tool directories
Display help about a specific command
SYNOPSIS
flutter [global-options] <command> [arguments]
Common commands:
flutter create <project_name>
flutter run [options]
flutter build <apk|ios|web|windows|macos|linux> [options]
flutter test [options]
flutter doctor [options]
flutter upgrade [options]
PARAMETERS
create
Creates a new Flutter project in the specified directory. Includes project structure, basic code, and necessary configuration files.
run
Runs your Flutter application on a connected device (simulator, emulator, physical device) or in a web browser/desktop window. Supports hot reload for rapid development.
build
Builds a production-ready artifact for the specified target platform (e.g., APK for Android, IPA for iOS, JavaScript for web, executable for desktop).
test
Runs the tests defined in your Flutter project. Supports unit, widget, and integration tests.
doctor
Checks your development environment and displays a report of the status of your Flutter installation and any missing dependencies (SDKs, tools, IDEs).
clean
Deletes the 'build' directory and other generated files from your Flutter project. Useful for resolving build issues or reducing project size.
upgrade
Upgrades your Flutter SDK to the latest available version. Also updates Dart SDK and installed packages.
pub
Manages Dart package dependencies for your Flutter project. Common uses include `pub get` to download dependencies and `pub upgrade` to update them.
install
Installs a Flutter application on a connected device without running it immediately. Useful for quick deployment of debug builds.
analyze
Analyzes the Dart code in your project for potential issues, errors, warnings, and style violations.
config
Configures Flutter settings such as device selection, analytics reporting, and enable/disable desktop development.
devices
Lists all connected physical devices and running emulators/simulators available for running Flutter applications.
emulators
Manages Android emulators. Used to list, create, and launch Android Virtual Devices (AVDs).
format
Formats Dart code according to Flutter's style guide.
DESCRIPTION
The flutter command is the primary command-line interface (CLI) tool for interacting with the Flutter SDK. Flutter is an open-source UI software development kit created by Google for building beautiful, natively compiled applications for mobile (Android, iOS), web, and desktop (Windows, macOS, Linux) from a single codebase. The command provides a comprehensive set of functionalities for managing the entire application development lifecycle. This includes creating new projects, running applications on various devices (simulators, emulators, physical devices, web browsers, desktop environments), building production-ready packages, testing code, analyzing project health, and upgrading the SDK itself.
The flutter CLI simplifies complex tasks such as dependency management (via Dart's pub package manager), debugging, and deployment. Its core philosophy revolves around rapid development with features like stateful hot reload, which allows developers to see changes instantly without losing application state. It acts as the gateway to the Flutter ecosystem, enabling developers to leverage Dart language features and a rich set of pre-built widgets to create highly performant and visually appealing user interfaces across multiple platforms.
CAVEATS
The flutter command relies heavily on a properly configured development environment. Key caveats include:
GLOBAL OPTIONS
The flutter command supports a few global options that apply to any subcommand:
ENVIRONMENT VARIABLES
The flutter command respects several environment variables for configuration:
HOT RELOAD VS. HOT RESTART
Two fundamental features for rapid development:
HISTORY
Flutter was initially released by Google in May 2017 (alpha release). Its development began as "Sky" in 2015. The first stable release, Flutter 1.0, was announced in December 2018 at the Flutter Live event, focusing primarily on mobile development for Android and iOS. A key development was the introduction of "hot reload," allowing developers to inject code changes into a running app without losing its state, significantly speeding up development cycles.
Subsequent versions expanded Flutter's capabilities to new platforms. Flutter 1.9 introduced web support (beta), and Flutter 2.0, released in March 2021, brought stable web support and broadened desktop application development to stable releases for Windows, macOS, and Linux. This multi-platform capability from a single codebase has been a significant driver of its adoption, making the flutter command an indispensable tool for cross-platform developers.