-
-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
SPM requires Dart 3.9.2 or newer and Flutter 3.3 or newer.
Install SPM globally from pub.dev:
dart pub global activate spmIf you prefer a project-local command, add it as a development dependency:
flutter pub add dev:spm
dart run spm:spm analyze --output results.jsonl /path/to/flutter/projectRun dart pub get from the repository root when working on SPM itself.
Start by creating one static-analysis row for every rebuild scope:
spm analyze --output results.jsonl /path/to/flutter/projectTo analyze only State subclasses, narrow the scope types:
spm analyze --output results.jsonl --scope-types State /path/to/flutter/projectThe simplest profiling path lets run inject the SpmState base class, launch Flutter in profile
mode, and restore the source afterward:
spm run --jsonl results.jsonl --flutter runYou can perform the transformation separately when you need to control the Flutter command:
spm inject --jsonl results.jsonl /path/to/flutter/project
# Launch the instrumented app here.
spm inject --jsonl results.jsonl --mode remove /path/to/flutter/projectAlways remove a standalone injection when the profiling run is finished.
isolate extracts rebuild scopes into smaller Dart files:
spm isolate --output-dir ./isolated_widgets /path/to/flutter/projectvalidate checks that a mutation changes widget-tree structure without changing frozen content or
state:
spm validate --base base.dart --mutation mutation.dartContinue with the individual command pages for flags and failure behavior. Output
Formats describes the records produced by analyze and run.
Commands
Reference
Internals
Contributing