Optimizing Flutter App Size
Optimizing Flutter App Size: Best Practices for Smaller, Faster Apps
In mobile development, app size matters. A lighter app improves download speed, reduces storage usage, and increases installation rates — especially in regions with slower internet connections or low-end devices. Flutter apps sometimes end up larger than expected, but with the right techniques you can significantly reduce your APK/AAB size.
This guide covers the most effective and developer-friendly ways to optimize your Flutter app size.
1. Use Release Mode for Production Builds
Debug builds are heavy because they include extra tooling. Whenever you measure or release your app, use:
flutter build apk --release
flutter build appbundle --releaseRelease mode shrinks the code, removes developer tools, and improves performance.
2. Remove Unused Dependencies
Every package you add increases your final app size.
Tips:
- Run
flutter pub depsto see all dependencies. - Remove packages you no longer use.
- Avoid packages that include heavy native libraries unless necessary.
Replacing multiple small packages with a custom utility can reduce size too.
3. Use Split APKs (ABI Splits)
Instead of building one universal APK, build smaller APKs for each CPU architecture:
flutter build apk --release --split-per-abiThis can reduce APK size by up to 60%, since each device downloads only what it needs.
4. Compress Images and Use WebP
Images are one of the biggest contributors to app size.
Best practices:
- Convert PNG/JPG images to WebP.
- Use SVGs for icons and simple graphics.
- Use tools like TinyPNG, Squoosh, or ImageOptim to compress assets.
5. Remove Unused Flutter Localization
By default, Flutter bundles many internationalization files.
Get Merajtariq’s stories in your inbox
Join Medium for free to get updates from this writer.
Add this to pubspec.yaml to restrict locales:
flutter:
generate: true
assets:
- assets/
flutter_intl:
enabled: trueOr specify:
flutter:
uses-material-design: true
assets:
- assets/
gen-l10n:
arb-dir: lib/l10n
supported-locales: [en]This removes unused ARB files and reduces bundle size.
6. Minify and Shrink Your Android Code (ProGuard / R8)
Enable code shrinking in android/app/build.gradle:
buildTypes {
release {
shrinkResources true
minifyEnabled true
}
}This removes unused Java/Kotlin code and optimizes bytecode.
7. Use Deferred Components (Android) or Deferred Loading (Flutter)
Load heavy features only when needed.
Example:
import 'package:flutter/foundation.dart' deferred as heavyModule;Future<void> loadModule() async {
await heavyModule.loadLibrary();
This helps especially in apps with:
- Large modules
- ML models
- Big asset packs
8. Avoid Bundling Large Files
If your app contains:
- Offline videos
- Big JSON files
- High-resolution animations
Move them to:
- Cloud storage
- Database
- Remote server
This keeps your initial install lightweight.
9. Use Flutter Clean + Tree Shaking
Flutter automatically removes unused Dart code, but running:
flutter clean
flutter pub getbefore a release build ensures no stale artifacts remain.
10. Analyze Your App Size
Flutter offers a built-in tool:
flutter build apk --analyze-sizeThis generates a detailed report showing what’s taking space — very useful for targeted optimization.
Final Thoughts
Optimizing your Flutter app size isn’t just a performance tweak — it directly affects user experience, install conversions, and even app store rankings. By following the techniques above, you can significantly cut down your app size without compromising features.



