Skip to main content

Flutter Basic Commands

This is a free guide to help developers get started with flutter which is an open-source project, with contributions from Google and the community.Flutter is an open-source UI software development kit created by Google. This guide contains a list of basic commands that are frequently used while developing flutter apps.


flutter basic commands

how to check flutter version ?

$ flutter --version

//Output
Flutter 1.7.8+hotfix.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 20e59316b8 (5 weeks ago) • 2019-07-18 20:04:33 -0700
Engine • revision fee001c93f
Tools • Dart 2.4.0

how to select a specific flutter version ?

$ flutter version v1.9.1+hotfix.3

how to upgrade flutter sdk and packages ?

$ flutter upgrade

//Output 
Upgrading Flutter from /home/dev/Desktop/workspace/flutter...
Updating d51fd86cd..20e59316b
 19 files changed, 61 insertions(+), 33 deletions(-)

Upgrading engine...
Downloading android-arm-profile/linux-x64 tools...                  1.0s
Downloading android-arm-release/linux-x64 tools...                  0.6s
Downloading android-arm64-profile/linux-x64 tools...                0.9s
Downloading android-arm64-release/linux-x64 tools...                1.4s
Downloading android-x86 tools...                                    2.4s
Downloading android-x64 tools...                                    2.1s
Downloading android-arm tools...                                    0.9s
Downloading android-arm-profile tools...                            0.8s
Downloading android-arm-release tools...                            0.5s
Downloading android-arm64 tools...                                  1.0s
Downloading android-arm64-profile tools...                          0.6s
Downloading android-arm64-release tools...                          0.5s
Downloading package sky_engine...                                   0.2s
Downloading common tools...                                         1.1s
Downloading common tools...                                         1.1s
Downloading linux-x64 tools...                                      3.3s

Flutter 1.7.8+hotfix.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 20e59316b8 (5 weeks ago) • 2019-07-18 20:04:33 -0700
Engine • revision fee001c93f
Tools • Dart 2.4.0

what are flutter channels ?

Flutter has following channels :
  • stable channel
    • Most Stable Build
    • Recommended channel for all production app releases
  • beta channel
    • "best" dev build of the previous month
  • dev channel
    • latest fully-tested build
  • master channel
    • Least Stable Build
    • latest cutting edge build

how to view your current channel ?

$ flutter channel

//Output 
Flutter channels:
* stable
  beta
  dev
  master
symbol * next to the channel name indicates your current channel

how to switch between flutter channels ?

Run command - use "flutter channel [channel-name]"
$ flutter channel dev
Using this command we can switch to dev channel

what is flutter doctor ?

This command that checks your environment and displays report of the status of flutter installation.
$ flutter doctor

  Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Linux, locale en_US.UTF-8)
 
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    [✓] Android Studio (version 3.5)
    [!] Connected device
    ! No devices available

    ! Doctor found issues in 1 category.

how to disable flutter analytics ? optional

$ flutter config --no-analytics

how to create a new flutter app ?

use "flutter create [app-name]"
$ flutter create yourappname

how to test your flutter app on a physical device ?

  • Connect your Android device to your computer with a USB cable.
  • Ensure that your have enabled USB DEBUGGING option
  • Navigate to and run command
$ flutter install
OR 
$ flutter run

how to build an android app bundle (aab) using flutter ?

Running flutter build defaults to a release build
$ flutter build appbundle
Note : release bundle for your app is created at /build/app/outputs/bundle/release/app.aab

how to build apk file using flutter ?

Running flutter build command defaults to a release build
$ flutter build apk 

Note : this command builds a fat apk
OR
$ flutter build apk --split-per-abi 

Note : the above command generated two apk files
  • armeabi-v7a (32-bit) apk
  • arm64-v8a (64-bit) apk

Useful Resources

What is fat apk ?

To learn more about flutter - Flutter Developer Guide

Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited.The materials(images, logos, content) contained in this web site are protected by applicable copyright and trade mark law.


Flutter, Pixel, Android and the Android logo are registered trademarks of Google LLC.

Popular posts from this blog

Step-by-Step Guide to create a new flutter project using Visual Studio Code [VS Code]

This is a beginner's guide to visual studio code and flutter. VS Code is a light weight editor with flutter app development, execution and debug support. Visual Studio Code is a source-code editor developed by Microsoft. Install latest stable version of VS Code Install the Flutter and Dart plugins In VS Code "Extensions" Tab, search field type flutter, select "Flutter" in the list and click "Install". Flutter plugin also installs the required Dart plugin. Validate your flutter setup using "flutter doctor command". Once Flutter SDK and your VS Code Editor is up and running, Flutter Visual Studio Code To Create a new flutter project from the flutter starter app template follow the below steps step 1 : Open Command Palette Use Shortcut key - Ctrl+Shift+P or Cmd+Shift+P on macOS OR Go to View Menu, select "Command Palette" VS Code Command Palette step 2 : Create Flutter New Project Sele

Step-by-Step Guide for Flutter Android APK Signing and Release

In this guide we will learn how to sign the release version of apk or aab(android app bundle) to publish our flutter app to android play store. flutter release apk How to sign the apk or app bundle created using flutter ? To publish your app on Play Store, you need to give your app a digital signature. step 1 : Create a new keystore file ; if you have an existing keystore , skip this step Run command in your terminal for linux/mac keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key On Windows, use the following command: keytool -genkey -v -keystore c:/Users/USER_NAME/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key Fill in the required info inside the terminal Enter keystore password: test@12345 Re-enter new password: test@12345 What is your first and last name? [test]: test What is the name of your organizational unit? [test]: test

Step-by-Step Guide to take a App Screenshot with the Device Frame using Android Studio

This guide will help you to take a screenshot with the device frame using android studio. If we capture screenshot using the default android emulator "Capture Screenshot" option, then screenshot will not have the device frame. Android Emulator - Screen Capture By using android studio we can capture screenshot with different devices frame. How to take a App Screenshot with the Device Frame using Android Studio step 1 : Load your project in android studio and run the app Open Android Studio Load your android app project in android studio.  Build and Run your app using android emulator or a connected physical device.  If you are using a physical device make sure that you have enabled USB DEBUGGING option. Android Studio - Load Project step 2 : Open Logcat in Android Studio Check out bottom left corner in android studio to find Logcat option and click to open Logcat If it is not visible then select "View Menu" and search for