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
Or
flutter -h
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
You can specify your company website and it will be used to create your application id.
flutter create --org=com.mycompany myproject
May you want to create a project with distinct folder name from project name.
flutter create --org=com.mycompany --project-name=myproject myfolder
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
Install Package
To install a package use the code below.
flutter pub add package_name
Update Packages
To update all the packages in your project, run the command below.
flutter pub upgrade
Build
To build your app and start using it in production, use that command.
flutter build target_platform_name --release
SDK Commands
Devices
List all the devices available in you computer.
flutter devices
Channel
Flutter has tree release channel, you can list them using the command below.
flutter channel
To switch the channel you want to use for your development, run the command below.
flutter channel channel_name
Bug Report
Upgrade
Upgrade the Flutter SDK.
flutter upgrade
Doctor
Show information and status of installed tools.
flutter doctor
References
Photo by Rodion Kutsaev on Unsplash
Top comments (0)