flutter-performancelisted
Install: claude install-skill ghozimahdi/gm-aiagent-plugins
Resolve `UFIL_ROOT` to the plugin root containing this skill. Claude Code may
provide `CLAUDE_PLUGIN_ROOT`; Codex can resolve it from the installed skill
path.
## Flutter Performance Patterns (GM Standard)
Rules + decision matrices for performance-critical Flutter UI choices. For full rationale, profiling workflow, and extended examples, read `${CLAUDE_PLUGIN_ROOT}/docs/PERFORMANCE.md`.
> **Note on colors in examples**: GM standard requires every color to come from generated `AppColors` (flutter_gen → `colors.gen.dart`). The snippets below use raw `Color(0x..)` / `Colors.xxx` only to keep the performance contrast self-contained — production code MUST use `AppColors.<name>`. See the Color rule in `${CLAUDE_PLUGIN_ROOT}/CLAUDE.md` and the implementer agent.
---
## 1. Const Class vs Helper Method (CRITICAL)
**Rule:** Prefer `const` widget class over helper method when the widget is reused or rebuilt frequently. Helper methods are called every rebuild and cannot be cached by Flutter; `const` widgets are instantiated once and reused.
### ❌ Helper method (cannot be cached)
```dart
Widget _buildPixelContainer() {
return Container(
width: 6, height: 6,
decoration: BoxDecoration(color: Colors.red.shade400, borderRadius: BorderRadius.circular(1)),
);
}
```
### ✅ Const widget class (cached by Flutter)
```dart
class PixelBox extends StatelessWidget {
const PixelBox({super.key});
@override
Widget build(BuildContext context) {
return Container(
width: