DevTools
size_analyzer Pro
- Tier
- Proversion 1.0.6
- Command
archipelago generate size_analyzer- Generates
devtools/scripts/size_analyzer
- Depends on
- monorepo_toolkitgenerate these first
Flutter
--analyze-sizereport parser with develop baseline diffing. Adds thesize-analyzercommand (analyze/update-baseline) to the basemonorepo_toolkit.
What it is / when to use it
A devtools CLI script — no DI, no app UI. size-analyzer analyze parses the JSON Flutter's --analyze-size build flag produces, ranks packages by contributed size, and (optionally) diffs against a committed baseline so a PR fails when it grows the app past a threshold. size-analyzer update-baseline regenerates that baseline, typically run on merge to develop. Requires the base monorepo_toolkit brick first.
Variables
| Variable | Type | Default | Description |
|---|---|---|---|
| appName | string | MyApp | The name of your application |
| isForMonorepo | boolean | true | Whether this is being generated as part of a monorepo |
Usage
Interactive
archipelago generate size_analyzerNon-interactive (CI)
archipelago generate size_analyzer --config my_config.jsonConfig Template
{
"@appName": "The name of your application",
"appName": "MyApp",
"@isForMonorepo": "Whether this is being generated as part of a monorepo",
"isForMonorepo": true
}Generated Structure
devtools/
└── scripts/
└── size_analyzer/
├── lib/
│ ├── size_analyzer.dart
│ └── src/
│ ├── commands/
│ │ ├── analyze_command.dart
│ │ ├── size_analyzer_command.dart
│ │ └── update_baseline_command.dart
│ ├── models/
│ │ └── size_node.dart
│ ├── reporters/
│ │ └── size_metrics_reporter.dart
│ └── services/
│ └── size_analyzer_service.dart
└── pubspec.yamlThe post_gen hook adds the package to the workspace, adds it as a dependency of monorepo_toolkit, and injects SizeAnalyzerCommand into command_runner.dart at the // --- Pro Commands --- marker. It does not scaffold a size_baseline/ directory or any baseline JSON files — those are written the first time you run update-baseline, at whatever path you pass to --output.
CLI Usage
# Parse a fresh Flutter --analyze-size report, show top 20 contributors
flutter build apk --analyze-size --target-platform android-arm64
dart run monorepo_toolkit size-analyzer analyze --json build/.../code-size-analysis_arm64.json
# ...diff against a committed baseline and show growth
dart run monorepo_toolkit size-analyzer analyze --json <path> --baseline size_baseline/android.json --platform android --top 20
# Update the baseline (run on merge to develop)
dart run monorepo_toolkit size-analyzer update-baseline --json <path> --output size_baseline/android.jsonanalyze requires --json/-j (mandatory) and accepts --baseline/-b, --platform/-p, and --top (default 20). update-baseline requires both --json/-j and --output/-o.
Dependencies
monorepo_toolkit— must be generated first.shared_scripts— providesMonorepoFinder,CliLogger.
Changelog
Run archipelago brick info size_analyzer to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.