flutter-reducing-app-size
Installation
Summary
Measure and optimize Flutter app bundle size across platforms with analysis tools and reduction strategies.
- Generates detailed size analysis JSON files via
--analyze-sizeflag to identify large packages, libraries, and assets contributing to bloat - Visualize and compare builds using DevTools app size tool with treemap inspection and diff functionality to track optimization progress
- Supports Android (APK/AAB), iOS, and desktop platforms with platform-specific workflows, including iOS app thinning size estimation via Xcode
- Implements four core reduction strategies: debug symbol splitting, unused resource removal, library resource minimization, and media compression
SKILL.md
Reducing Flutter App Size
Contents
- Core Concepts
- Workflow: Generating Size Analysis Files
- Workflow: Analyzing Size Data in DevTools
- Workflow: Estimating iOS Download Size
- Workflow: Implementing Size Reduction Strategies
- Examples
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-sizeflag generates a*-code-size-analysis_*.jsonfile 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.