flutter: The Flutter command-line tool

The flutter command-line tool is how developers (or IDEs on behalf of developers) interact with Flutter. For Dart related commands, you can use the dart command-line tool.

Here's how you might use the flutter tool to create, analyze, test, and run an app:

$ flutter create my_app
$ cd my_app
$ flutter analyze
$ flutter test
$ flutter run lib/main.dart

To run pub commands using the flutter tool:

$ flutter pub get
$ flutter pub outdated
$ flutter pub upgrade

To view all commands that flutter supports:

$ flutter --help --verbose

To get the current version of the Flutter SDK, including its framework, engine, and tools:

$ flutter --version

flutter commands

#

The following table shows which commands you can use with the flutter tool:

CommandExample of useMore information
analyzeflutter analyze -d <DEVICE_ID>Analyzes the project's Dart source code.
Use instead of dart analyze.
assembleflutter assemble -o <DIRECTORY>Assemble and build flutter resources.
attachflutter attach -d <DEVICE_ID>Attach to a running application.
bash-completionflutter bash-completionOutput command line shell completion setup scripts.
buildflutter build <DIRECTORY>Flutter build commands.
channelflutter channel <CHANNEL_NAME>List or switch flutter channels.
cleanflutter cleanDelete the build/ and .dart_tool/ directories.
configflutter config --build-dir=<DIRECTORY>Configure Flutter settings. To remove a setting, configure it to an empty string.
createflutter create <DIRECTORY>Creates a new project.
custom-devicesflutter custom-devices listAdd, delete, list, and reset custom devices.
devicesflutter devices -d <DEVICE_ID>List all connected devices.
doctorflutter doctorShow information about the installed tooling.
downgradeflutter downgradeDowngrade Flutter to the last active version for the current channel.
driveflutter driveRuns Flutter Driver tests for the current project.
emulatorsflutter emulatorsList, launch and create emulators.
gen-l10nflutter gen-l10n <DIRECTORY>Generate localizations for the Flutter project.
installflutter install -d <DEVICE_ID>Install a Flutter app on an attached device.
logsflutter logsShow log output for running Flutter apps.
precacheflutter precache <ARGUMENTS>Populates the Flutter tool's cache of binary artifacts.
pubflutter pub <PUB_COMMAND>Works with packages.
Use instead of dart pub.
runflutter run <DART_FILE>Runs a Flutter program.
screenshotflutter screenshotTake a screenshot of a Flutter app from a connected device.
symbolizeflutter symbolize --input=<STACK_TRACK_FILE>Symbolize a stack trace from the AOT compiled flutter application.
testflutter test [<DIRECTORYDART_FILE>]Runs tests in this package.
Use instead of dart test.
upgradeflutter upgradeUpgrade your copy of Flutter.

For additional help on any of the commands, enter flutter help <command> or follow the links in the More information column. You can also get details on pub commands — for example, flutter help pub outdated.