dimitriremoiville/cc-mobile/flutter-performance
Claude Code and agent skill by dimitriremoiville/cc-mobile
- community
Checking that the SKILL.md file is still in the repository.
Flutter performance patterns — DevTools (Performance, CPU profiler, Memory), rebuild tracking, `const` hygiene, image decoding, `ListView.builder`, `RepaintBoundary`, `--profile` measurement, Skia vs Impeller considerations. Load when investigating jank, scroll stutter, cold-start regressions, or shipping a release build.
Install
npx vskill@latest install dimitriremoiville/cc-mobile/flutter-performanceSKILL.md
The same SKILL.md was published earlier as dimitriremoiville/cc-mobile/flutter-performance.
Flutter performance
Measure first
Run in --profile mode. Debug builds are slower than release; release builds hide the observatory. --profile gives both.
Open DevTools, go to Performance tab, record a session of the suspect interaction.
DevTools staples
- Performance: UI + raster thread frame times. Any UI-thread frame >16ms on 60Hz or >8ms on 120Hz is a dropped frame.
- CPU Profiler: flame graph of what the UI thread is doing during jank.
- Memory: track leaks, watch the heap grow.
- Widget Inspector + "Highlight Rebuilds" + "Show Performance Overlay" toggles.
Rebuild tracking
Enable "Track Widget Builds" in the inspector to see which widgets are rebuilding. Aim for: only widgets whose inputs changed rebuild.
For manual logging in dev:
Ship neither the debug print nor any dev logging — guard behind assert(() { ...; return true; }());.
const hygiene
- Constructor with
const: the widget is canonicalized and skips rebuilds when the context says nothing changed. consteverywhere:const Icon(...),const SizedBox(...),const EdgeInsets.all(...).- The analyzer flags
prefer_const_constructorsandprefer_const_literals_to_create_immutables— keep them on. CI should fail on new violations.
Bloc / state hygiene
BlocSelectornarrows which state changes trigger a rebuild — one per small leaf widget.BlocBuilderwith a custombuildWhen:also works.- Never call
setStatein abuildmethod (obviously) and never mutate state insidebuilder:.
ListView / scroll
ListView.builder(lazy) for >10 items, notListView(children: [...]).itemExtentorprototypeItem— lets the viewport pre-calculate scroll offsets. MakesjumpTo+ scrollbars accurate, and avoids laying out every item for measurement.CustomScrollView+SliverListwhen you mix scroll behaviors.
RepaintBoundary
For widgets that animate independently of their siblings (a ColorFiltered spinner above a static list), wrap in RepaintBoundary so Flutter doesn't invalidate the static siblings' raster caches every frame.
Be selective. RepaintBoundary everywhere is itself a cost.
Images
- Always specify
width/height(or usecacheWidth/cacheHeight) so Flutter decodes at display size rather than native resolution. Image.asset(...)withcacheWidth: 128for a 64x64 displayed image (2x for hiDPI).- For network images,
cached_network_imagegives disk + memory caching out of the box. FadeInImagevsImage.network:FadeInImagehandles placeholder + fade, but it lays out twice — prefer a proper placeholder widget.
Animations
AnimatedBuilder/AnimatedWidgetinstead of rebuilding the whole subtree every frame.- Use
RepaintBoundaryaround animated subtrees. - For list reorder animations,
AnimatedList+ key discipline.
Startup
main()should do:WidgetsFlutterBinding.ensureInitialized()→ flavor config →runApp(...). Everything else deferred or async.- Firebase init + remote config:
unawaited(_initializeFirebase())afterrunAppif you can tolerate a short delay. - Lazy-load GetIt singletons: prefer
registerLazySingletonoverregisterSingletonfor expensive objects.
Memory
- Dispose controllers (
TextEditingController,ScrollController,AnimationController) indispose(). - Cancel stream subscriptions.
flutter_blochandles its own disposal viaclose(); outside bloc, own your subscriptions.
Platform channels
- Marshalling large payloads over platform channels is expensive. Send ids + fetch details through a dedicated background isolate when the payload is >1MB.
pigeonfor typed channels — compile-time safety is cheaper than runtime debugging.
Isolates
CPU-bound work (image manipulation, parsing large JSON, cryptography) runs off the UI isolate:
For repeated work, a long-lived isolate pool beats spawning one per call.
Impeller (iOS and Android)
Impeller is now the default on iOS 17+ and Android 14+. If you see shader compilation jank on first run of a screen, enable Impeller explicitly in Info.plist (iOS) and AndroidManifest.xml (Android). For older devices, Skia's first-run shader warmup via flutter run --cache-sksl still applies.
Shipping measurement
- Run on a low-end device (iPhone SE / Pixel 6a). Not the tester's iPhone 15 Pro.
- Record the P95 frame time over a scripted interaction. PR descriptions include before/after numbers.
Hard nos
- No optimization without a measurement.
- No
setStateballooning into business state (use a bloc / cubit / provider). - No
Image.network('...')inline for thumbnails — usecached_network_image+ sized decoding. - No
StreamBuilderover a long-lived stream without managing subscription disposal. - No profiling in debug and claiming a result.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/cc-mobile-flutter/skills/flutter-performance/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dimitriremoiville/cc-mobile/flutter-performance)