Determine Target Platform: — Ask the user which platform they are targeting (apk, appbundle, ios, linux, macos, windows) and their size reduction goal.
2
Generate Size Analysis File: — Run `flutter build <platform> --analyze-size` to generate a size analysis JSON file.
3
Generate iOS App Size Report (iOS Only): — If targeting iOS, run `flutter build ipa --export-method development` and generate an Xcode App Thinning Size Report.
4
Analyze Components in DevTools: — Launch Dart DevTools and upload the generated JSON file to the App Size Tool to identify large components.
5
Implement Size Reduction Strategies: — Apply strategies like `--split-debug-info`, asset compression, and platform-specific tree-shaking.
6
Validate and Fix: — Regenerate the size analysis file and compare it with the original to ensure the app size decreased to meet the requirements.