| name | flutter-reducing-app-size |
| description | Measures and optimizes the size of Flutter application bundles for deployment. Use when minimizing download size or meeting app store package constraints. |
| metadata | {"model":"models/gemini-3.1-pro-preview","last_modified":"Thu, 12 Mar 2026 22:22:44 GMT"} |
Reducing Flutter App Size
Contents
Core Concepts
- Debug vs. Release: Never use debug builds to measure app size. Debug builds include VM overhead and lack Ahead-Of-Time (AOT) compilation and tree-shaking.
- Upload vs. Download Size: The size of an upload package (APK, AAB, IPA) does not represent the end-user download size. App stores filter redundant native library architectures and asset densities based on the target device.
- AOT Tree-Shaking: The Dart AOT compiler automatically removes unused or unreachable code in profile and release modes.
- Size Analysis JSON: The
--analyze-size flag generates a *-code-size-analysis_*.json file detailing the byte size of packages, libraries, classes, and functions.
Workflow: Generating Size Analysis Files
Use this workflow to generate the raw data required for size analysis.
Task Progress:
Conditional Logic:
- If targeting Android: Run
flutter build apk --analyze-size or flutter build appbundle --analyze-size.
- If targeting iOS: Run
flutter build ios --analyze-size. Note: This creates a .app file useful for relative content sizing, but not for estimating final App Store download size. Use the Estimating iOS Download Size workflow for accurate iOS metrics.
- If targeting Desktop: Run
flutter build [windows|macos|linux] --analyze-size.
Workflow: Analyzing Size Data in DevTools
Use this workflow to visualize and drill down into the Size Analysis JSON.
Task Progress:
Workflow: Estimating iOS Download Size
Use this workflow to get an accurate projection of iOS download and installation sizes across different devices.
Task Progress:
Workflow: Implementing Size Reduction Strategies
Apply these strategies to actively reduce the compiled footprint of the application.
Task Progress:
Examples
Generating Size Analysis (Android)
flutter build appbundle --analyze-size --target-platform=android-arm64
Splitting Debug Info (Release Build)
flutter build apk --obfuscate --split-debug-info=build/app/outputs/symbols
Reading the iOS App Thinning Size Report
When reviewing App Thinning Size Report.txt, look for the specific target device to understand the true impact on the user:
Variant: Runner-7433FC8E-1DF4-4299-A7E8-E00768671BEB.ipa
Supported variant descriptors: [device: iPhone12,1, os-version: 13.0]
App + On Demand Resources size: 5.4 MB compressed, 13.7 MB uncompressed
App size: 5.4 MB compressed, 13.7 MB uncompressed
Interpretation: The end-user download size (compressed) is 5.4 MB, and the on-device footprint (uncompressed) is 13.7 MB.