We know that you have already completed your setup of the flutter development environment with your favorite IDE(Android Studio or VSCode).
After creating several projects, you are here to know what are the essential “Flutter commands”.Let’s Start.
$ flutter create --androidx -t app --org
Now above is the code for creating the whole project perfectly. We can also go for “flutter create app_name” but that will add some default dependency that we generally need to avoid in flutter application development.
com.companyname.packagename -a java -i swift appname
Now let’s understand the whole command partition-wise.
- flutter creates: This command is used for creating a flutter project from scratch.
- — androidx: Here, we are adding androidx support libraries so we can easily migrate our project to androidx.
- -t app: -t stands for “Type”. -t specifies which type of project you want to create. -t has three types app, package, and plugin.
- app: default flutter application
- package: create a sharable flutter project which has modular code.
- plugin: to create a platform-specific plugin
4. — org com.companyname.packagename: — org means the organization name for whom you are creating a project which will be written as com.companyname.packagename. Also, this whole name should be unique for uploading the whole app to the google play store.
5. -a java: -a means adding android language support to your app. Here, we have java. We can also add kotlin. If we do not specify then the kotlin support will be added.
6. -i swift: -i mean adding ios language support to your app. Here, we have swift. We can also add obj c. Here also if we do not specify then swift will be added y default.
$ flutter run
The above command is for running your application on mobile or an emulator. Make sure your IDE is connected to one of them.
This command has different types:
$ flutter run --profile
— profile is for performance profiling but this will not work if you are working on an emulator. It will work only on real devices.
$ flutter run --release
— release is used for running the release version of the application.
$ flutter run --flavor
— flavor is a custom app flavor defined by a platform-specific build setup. For more info please visit here.
$ flutter run --debug
— debug is used for running the debug version of the application.
$ flutter doctor
After installing the flutter SDK we also need to add the necessary tools to make our project complete. Above as we can see there are two issues in the flutter project. You can also see full details by flutter doctor -v.
$ flutter upgrade
This command will update the flutter SDK to the latest version.
$ flutter build apk
This command will build the apk which we can deploy to the play store.
$ flutter pub get
This command will download the dependencies which are listed in pubspec.yaml file and also updates other dependencies that are required for our project.
$ flutter devices
You can check all the devices which are connected to the project. Also if you write a “flutter emulator” command then it will display the list of emulators that are currently installed on your system.
$ flutter clean
The above command is responsible for deleting files in the build folder. Generally, the main purpose of this command is your device or emulator should display all the changes that you did in your project after disconnecting your device or emulator from the system.
In this blog, we have covered the necessary commands we also explained all the commands that you will require from creating your new project and uploading it to the app or play store. If you like this blog then don’t forget to hit the clap icon 10 times. Happy coding…