Introduction

When developing a Flutter app, you will need to run a series of commands to build, test, and deploy your app.

This article will cover some of the most useful Flutter commands that you will need to know and serve as a reference for my future self and anyone else who might find it useful.

Useful Commands

Generate Localizations Files when using flutter_localizations

Sometimes, you might need to add a new language to your app or the build runner might fail to generate the localizations files. In such cases, you can run the following command to generate the localizations files:

flutter gen-l10n

Recreate missing android and ios folders

If you accidentally delete the android and ios folders, or you have missing files, you can run the following command to recreate them:

flutter create .

or if you have specified an organization name when creating your Flutter project :

flutter create --org <your_build_name> .

Upgrade Flutter SDK and Packages

To upgrade the Flutter SDK and packages, you can run the following command:

Note that this command will upgrade the Flutter SDK and packages to the latest version only if no conflicting constraints are found in the pubspec.yaml file.

flutter upgrade && flutter pub upgrade --major-versions

Automatically apply suggested fixes to your Flutter project

If you are using an IDE like VS Code, you can run the following command to automatically apply suggested fixes to your Flutter project.

If is especially useful when you are migrating your Flutter project to null safety or new versions of Flutter releases breaking changes features.

dart fix --apply

Run Flutter app in release mode

Did you know that you can run your Flutter app in release mode without having to build an APK or IPA file? This mean that you can test your app in release mode on your device even if you don’t have a developer account or are not plugged in to your computer.

You can do so by running the following command:

flutter run --release

This is a work in progress and I will be adding more commands as I discover them. If you have any suggestions, please let me know.


I hope this article was helpful, if you have any question or suggestion, feel free to reach out to me on :

You can use my articles with no cost or attribution, feel free to edit them and make them your own.