Top 6 essential flutter commands

Currently, Flutter comes with 22 powerful commands. In this article, we are going to top 6 essential flutter commands which are the most important to know to start working with fluter. To be Flutter Master keep reading. To use all this command make sure flutter command is recognized by your PC if not set the Flutter SDK path in Environment variables. If you have not yet installed flutter check our article on how to install flutter

1.flutter upgrade

This command is for upgrading the flutter.This one simple command will take care of everything related to upgrading including DART  and all necessary. If you run this command you might see something similar as below

Upgrading Flutter from E:\..................\flutter...
   5a58b36..b397406  beta       -> origin/beta
 + 475d271...2a51829 Hixie-patch-2 -> origin/Hixie-patch-2  (forced update)
   b397406..f408bb0  dev        -> origin/dev
   7010bd4..ea30c95  master     -> origin/master
 * [new tag]         v0.2.10    -> v0.2.10
 * [new tag]         v0.2.11    -> v0.2.11
 * [new tag]         v0.2.9     -> v0.2.9
Updating 5a58b36..b397406
 489 files changed, 17458 insertions(+), 7281 deletions(-)

Upgrading engine...
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine c903c217a1a8206cdebdab1703b52ec6180edf37...
Unzipping Dart SDK...
Updating flutter tool...
Downloading package sky_engine...

Flutter 0.2.3 • channel beta •
Framework • revision 5a58b36e36 (4 weeks ago) •  13:53:20 -0700
Engine • revision c903c217a1
Tools • Dart 2.0.0-dev.35.flutter-290c576264

2.flutter doctor

This command will show all the necessary details all the tool which are required to flutter to work. Read the console carefully like like

  1. Android SDK is present or not
  2. Android Studio is installed or not
  3. DART is installed or not
  4. Any android device is connected to the PC or not, etc.

In the end, it will list out all the issues available

run flutter doctor -v you will see something similar

[√] Flutter (Channel beta, v0.2.8, on Microsoft Windows [Version 10.0.16299.371], locale en-US)
    • Flutter version 0.2.8 at E:\........\flutter
    • Framework revision b397406561 (12 days ago), 2018-04-02 13:53:20 -0700
    • Engine revision c903c217a1
    • Dart version 2.0.0-dev.43.0.flutter-52afcba357

[!] Android toolchain - develop for Android devices (Android SDK 27.0.1)
    • Android SDK at C:\adt-bundle-windows-x86_64-20140702\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
    X Android license status unknown.

[√] Android Studio (version 3.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[√] VS Code, 64-bit edition (version 1.21.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Dart Code extension version 2.11.2

[!] Connected devices
    ! No devices available

! Doctor found issues in 2 categories

In the above result, you can see that it has two issues 1. No Android device is connected 2. Android license status is unknown.

3.flutter create

This command is used to create flutter project, you need to provide the directory name/project name where you want to create the project. like flutter create your_project_name you cannot use a capital letter to create flutter project.

run flutter create my_awesome_project you will see something similar

C:\Users\...\temp>flutter create my_awesome_project
Creating project my_awesome_project...
  my_awesome_project\.gitignore (created)
  my_awesome_project\.idea\libraries\Dart_SDK.xml (created)
  my_awesome_project\.idea\libraries\Flutter_for_Android.xml (created)
  my_awesome_project\.idea\modules.xml (created)
  my_awesome_project\.idea\runConfigurations\main_dart.xml (created)
  my_awesome_project\.idea\workspace.xml (created)
  my_awesome_project\.metadata (created)
  my_awesome_project\android\app\build.gradle (created)
  my_awesome_project\ios\Runner\Base.lproj\Main.storyboard (created)
  my_awesome_project\ios\Runner\Info.plist (created)
  my_awesome_project\ios\Runner.xcodeproj\project.xcworkspace\contents.xcworkspacedata (created)
  my_awesome_project\ios\Runner.xcodeproj\xcshareddata\xcschemes\Runner.xcscheme (created)
  my_awesome_project\ios\Runner.xcworkspace\contents.xcworkspacedata (created)
  my_awesome_project\lib\main.dart (created)
  my_awesome_project\my_awesome_project.iml (created)
  my_awesome_project\my_awesome_project_android.iml (created)
  my_awesome_project\pubspec.yaml (created)
  my_awesome_project\ (created)
  my_awesome_project\test\widget_test.dart (created)
Wrote 65 files.

Running "flutter packages get" in my_awesome_project...     20.1s

[√] Flutter is fully installed. (Channel beta, v0.2.8, on Microsoft Windows [Version 10.0.16299.371], locale en-US)
[!] Android toolchain - develop for Android devices is partially installed; more components are available. (Android SDK 27.0.1)
[√] Android Studio is fully installed. (version 3.0)
[√] VS Code, 64-bit edition is fully installed. (version 1.21.1)
[!] Connected devices is partially installed; more components are available.

Run "flutter doctor" for information about installing additional components.

All done! In order to run your application, type:

  $ cd my_awesome_project
  $ flutter run

Your main program file is lib/main.dart in the my_awesome_project directory.


4.flutter run

This command is for to run your flutter application/ project for this you need to have a device up and running and connected to adb. ie Either you can connect your real device (turn on USB debugging mode ) or you can use Android Virtual Device form Android studio. If no devices is found it will not execute

go inside your project and execute flutter run if any compatible device is connected to your PC you will see something like this

Running "flutter packages get" in my_awesome_project...             5.6s
Launching lib/main.dart on Moto G 5S Plus in debug mode...
Initializing gradle...                                       7.8s
Resolving dependencies...                                   73.8s
Running 'gradlew assembleDebug'...                          113.2s
Built build\app\outputs\apk\debug\app-debug.apk (30.3MB).
Installing build\app\outputs\apk\app.apk...                 12.6s
I/FlutterActivityDelegate(20336): onResume setting current activity to this
Syncing files to device Moto G 5S Plus...      
🔥 To hot reload your app on the fly, press "r". To restart the app entirely, press "R".
An Observatory debugger and profiler on Moto G 5S Plus is available at:
For a more detailed help message, press "h". To quit, press "q".

You can see the device name in line no 2.

If you change any code you don’t have to re-run this command press R it will update the latest code no need to restart the whole app this is called hot swapping. To exit press q


5.flutter stop

To stop flutter app form running. If you used the command flutter run to run your flutter app to stop you can open the command prompt from the same directory again and run flutter stop command, you will see something similar

Initializing gradle...                                       3.0s
Resolving dependencies...                                    7.5s
Stopping apps on Moto G 5S Plus.

6. flutter devices

To get the list of devices connected currently connected with the pc, it can be a real device or virtual device by running this command along with the device name you can see the api version (Android version) of the device

run flutter devices command you will see something similar

1 connected device:

Moto G 5S Plus • ZY3229C8DS • android-arm • Android 7.1.1 (API 25)



Other non essential flutter commands

  1. flutter analyze Analyze the project’s Dart code.
  2. flutter build Flutter build commands.
  3. flutter channel List or switch flutter channels
  4. flutter clean Delete the build/ directory.
  5. flutter config Configure Flutter settings.
  6. flutter drive Runs Flutter Driver tests for the current project.
  7. flutter format Format one or more dart files.
  8. flutter  fuchsia_reload Hot reload on Fuchsia.
  9. flutter help Display help information for flutter.
  10. flutter install Install a Flutter app on an attached device.
  11. flutter logs Show log output for running Flutter apps.
  12. flutter packages Command for managing Flutter packages.
  13. flutter precache Populates the Flutter tool’s cache of binary artifacts.
  14. flutter screenshot Take a screenshot from a connected device.
  15. flutter test Run Flutter unit tests for the current project.
  16. flutter trace Start and stop tracing a running Flutter app.

Leave a Reply

Your email address will not be published. Required fields are marked *