To Reducing the size of your Flutter app is a major task and crucial for improving performance, decreasing load times, and enhancing user experience. Below are seven practices to help you achieve a smaller flutter app size:
1. Use SVG Images:
Use SVG Images instead of PNG or JPEG images. As SVG images are vector images, which means they can be scaled to any size without losing image quality. This makes them much smaller than PNG or JPEG images, which are raster images.
2. Compress Images:
Compress your images. Even if you’re using svg images, you can still compress them to further reduced size. There are many online tools that can help you to compress SVG images.
3. Remove unused resources:
Remove unused resources. Before publishing your application, take a look at all of the resources that you’re including in it. Are there any resource that you’re not actually using? if so, remove them. This will help to reduce the size of your app.
4. Use code obfuscator:
use a code obfuscator. A code obfuscator can help to reduce the size of your app by making your code more compact. This is done by remaining vairables, functions, and other elements of your code.
5. use Android App Bundles:
Use Android App Bundles. Android App bundles(AAB’s) are a new way to publish or distribute Android apps in playstore. AAB’s allow you to split your application into multiple APK’s each of which is optimized for a specific devices configuation. This can help to reduce the size of your app from users with older devices.
6. Avoid using large images:
Avoid using large images for icons or splash screens. Icons and splash screens are often the first things that users see when they launch process and make your app feel sluggish.
7. use lazy loading:
using lazy loading is a technique that allows you to load images or other resources only when they’re needed. This can help to reduce flutter app size and even app performance is increased.