Flutter performance audit
Skill almasumdev/awesome-flutter-agent-skills/.github/skills/performance/flutter-performance-audit
Identify excessive widget rebuilds, missing const constructors, unstable keys, and jank in Flutter apps using DevTools. Use this when profiling or optimizing UI performance.From its SKILL.md
npx -y skills add almasumdev/awesome-flutter-agent-skills --skill flutter-performance-auditAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.2 KB, 780 tokens by cl100k_base, as published. Nobody here has run it
Flutter Widget Rebuild & Performance Audit
Instructions
Use Flutter DevTools plus code review to find and fix the common causes of jank and wasted rebuilds.
1. Measure First
- Run in profile mode:
flutter run --profile— debug mode is not representative. - Open DevTools → Performance tab. Record a trace while reproducing the jank.
- Look for frames > 16ms (60Hz) or > 8ms (120Hz). Identify the dominant phase: UI thread (Dart) vs Raster thread (GPU).
2. Find Excessive Rebuilds
- DevTools → Performance → Track widget builds and Highlight repaints.
- Enable the Rebuild Stats panel. Any widget rebuilding more than expected is a candidate.
- In code, add
debugPrint('build $runtimeType')in suspectbuildmethods to count rebuilds in dev.
Common culprits:
- Missing
conston leaf widgets → entire subtree rebuilds with parent. context.watch/ref.watchat the top of a screen → whole screen rebuilds on any state change.- New
Function/Controller/Decorationinstances created insidebuild. - Parent widget does not use
==/hashCode(not@immutable), causing child to think it changed.
3. Narrow Rebuild Scope
- Extract children into separate widgets so their
buildonly runs when their own state changes. - Read providers as deep as possible. Use
Consumer/Selector/BlocSelectorto subscribe to a slice of state. - Use
ValueListenableBuilder/AnimatedBuilderfor tight animation updates instead of callingsetStateon the whole screen.
4. Lists and Grids
- Use
ListView.builder/SliverList.builder— neverListView(children: [...])for long lists. - Set
itemExtentorprototypeItemwhen row height is uniform — enables O(1) scrolling. - Add stable
ValueKey(item.id)to list items that can reorder. - Use
AutomaticKeepAliveClientMixinorPageStorageKeyonly when state preservation is actually needed.
5. Images
- Always set
cacheWidth/cacheHeight(ormemCacheWidth/memCacheHeightincached_network_image). - Reuse
ImageProviderinstances. Seeflutter-imagesskill.
6. Raster / GPU Issues
- Avoid full-screen
BackdropFilter(blurs) — expensive on the raster thread. - Avoid stacked
Opacity/ClipRRecton animating children — preferFadeTransitionand pre-baked shapes. - Enable the Raster Cache layer overlay (DevTools) to confirm static sublayers are cached.
7. Isolates for CPU Work
Parsing large JSON, image decoding, or cryptography on the UI thread causes jank. Offload to Isolate.run(...) (Dart 3) or compute(fn, arg).
8. Audit Checklist
-
flutter analyzepasses withprefer_const_constructors+prefer_const_literalsenabled. - No widget in the performance trace rebuilds more than expected.
- Lists use
.builder, keys, and bounded item size. - No
Opacity,Clip*, orBackdropFilteron hot animated subtrees. - JSON parsing > ~10ms is moved to an isolate.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.