DEV Community

Cover image for Flutter CLI Cheat Sheet
Assis Ferreira
Assis Ferreira

Posted on • Updated on

Flutter CLI Cheat Sheet

This is a cheat sheet for the most useful commands you will need when developing a flutter app.


Help

To see all the commands, call the help as below.

flutter --help
Enter fullscreen mode Exit fullscreen mode

Or

flutter -h
Enter fullscreen mode Exit fullscreen mode

Start Project Commands

New project

To create a new project just run the below command, don't forget to replace myproject to your project name lol.

flutter create myproject
Enter fullscreen mode Exit fullscreen mode



You can specify your company website and it will be used to create your application id.

flutter create --org=com.mycompany myproject
Enter fullscreen mode Exit fullscreen mode



May you want to create a project with distinct folder name from project name.

flutter create --org=com.mycompany --project-name=myproject myfolder
Enter fullscreen mode Exit fullscreen mode

Development Commands

Run

To run your project, just go to root directory of your project and run the code below, and next choose the device where you want to run your project.

flutter run
Enter fullscreen mode Exit fullscreen mode

Install Package

To install a package use the code below.

flutter pub add package_name
Enter fullscreen mode Exit fullscreen mode

Update Packages

To update all the packages in your project, run the command below.

flutter pub upgrade
Enter fullscreen mode Exit fullscreen mode

Build

To build your app and start using it in production, use that command.

flutter build target_platform_name --release
Enter fullscreen mode Exit fullscreen mode

SDK Commands

Devices

List all the devices available in you computer.

flutter devices
Enter fullscreen mode Exit fullscreen mode

Channel

Flutter has tree release channel, you can list them using the command below.

flutter channel
Enter fullscreen mode Exit fullscreen mode



To switch the channel you want to use for your development, run the command below.

flutter channel channel_name
Enter fullscreen mode Exit fullscreen mode

Bug Report

Upgrade

Upgrade the Flutter SDK.

flutter upgrade
Enter fullscreen mode Exit fullscreen mode

Doctor

Show information and status of installed tools.

flutter doctor
Enter fullscreen mode Exit fullscreen mode

References

Photo by Rodion Kutsaev on Unsplash

https://docs.flutter.dev/reference/flutter-cli

Top comments (0)