build_slim 0.4.0
build_slim: ^0.4.0 copied to clipboard
A CLI tool and library to analyze and reduce the size of Flutter APK, AAB, and IPA build artifacts using best-practice optimizations.
build_slim example #
This folder demonstrates how to use build_slim in a Flutter project.
1. Add the package #
flutter pub add --dev build_slim
Or activate it globally:
dart pub global activate build_slim
2. Analyze your project #
dart run build_slim optimize --analyze-only
This prints a list of findings without modifying files or starting a build.
3. Build an optimized APK #
dart run build_slim optimize --target apk --tree-shake-icons --obfuscate
The tool will:
- Analyze your project.
- Patch Android Gradle settings safely (with
.bakbackups). - Inject
--tree-shake-icons,--obfuscate, and--split-debug-info. - Run
flutter build apk. - Print a before/after summary.
4. Compare artifacts #
If you already have two builds, compare them with:
build_slim report \
--before ./build/app/outputs/flutter-apk/app-before.apk \
--after ./build/app/outputs/flutter-apk/app-after.apk \
--format html \
--output ./size_diff.html