By WalkingTree September 21, 2020
Many users avoid downloading any application which is too large. According to a report, about 337 million smartphone users have limited data plans and they don’t want to waste their data on a single application. So after all the coding, it’s best to optimize and try to reduce the app size. Let’s take a look at some of the ways of reducing the Flutter app size.
Image Asset – In Flutter, developers use images from the assets folder. In development mode, this will be useful as the images are loaded faster. But when you bundle the app these images add more weight to the app. The solution is to use network images. Upload the images in a permanent storage path like AWS and use the link to that image in your code.
Use Google Fonts – Similar to images, custom fonts will also increase app size. The best solution is to use the google_fonts plugin. This plugin will dynamically download a font when it is used and will download in a specific style and language.
Icons – It is recommended to use the Material Icons or Cupertino Icons class. Developers can also add –tree-shake-icons option to the flutter build command, to remove all unwanted icons from the bundle. This will potentially save the size of the app.
Cache – Using the cache will not technically help in reducing app size but it will make the app load faster and hence improve the app performance. The cached_network_image package allows you to use any widget as a placeholder.
Use Specific Libraries – Calling packages not used in pubspec.yaml file should be avoided. Once done building your app, you should check your pubspec.yaml and remove libraries that are not used. Also, remove all the unused assets from pubspec.yaml.
Read on to know more about Flutter and how you can reduce the app size.
In recent times, due to the effects of the pandemic, a mask detecting app is in great need….
Theming is styling an application so that its look and feel matches your personal design aesthetic or that…
In this blog, we have collated the important Flutter best practices that should be kept in mind for…