Image for Tips And Tricks to make Flutter Development easier

Tips And Tricks to make Flutter Development easier

Enabling AndroidX :

Instead of expecting an androidX error, you can always enable androidX right when you create the project.

Terminal window
flutter create --androidx app_name

Specifying package name :

You have to change the application ID/ package name at some point in your development. So why not at the time of project creation.

Terminal window
flutter create --org com.bimsina awesome_app

The above code will create an app with the application ID com.bimsina.awesome_app.

Reducing App Size:

Wondering why your app is larger than usual? It’s probably because the app is running in debug mode. Well to run you application in release mode, you can always build a version of apk that will be release in the Google PlayStore.

Terminal window
flutter build apk

Building AndroidApp Bundle (aab):

PlayStore recommends that you upload aab instead of apk as it helps in the reduction of download size in the user’s end.

Terminal window
flutter build appbundle --target-platform android-arm, android-arm64

By using the target property you can specify to build only for 64 bit processors too.

Clean the project:

Facing a problem after adding various packages? The easiest solution is to clean the project and rebuild it again.

Terminal window
flutter clean

This will delete your build/ directory and its created again when you rebuild the application.