state-management-hygiene

Audits Flutter providers for disposal, immutability, rebuild scope, and side-effect placement.

Updated Mar 9, 2026
One-click install
npx skills add https://github.com/yunior123/origna_gta_firebase --skill state-management-hygiene-yunior123
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: state-management-hygiene
Source: https://github.com/yunior123/origna_gta_firebase/tree/main/.claude/skills/state-management-hygiene
Command: npx skills add https://github.com/yunior123/origna_gta_firebase --skill state-management-hygiene-yunior123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Flutter codebases accumulate state management defects such as undisposed controllers, mutable state objects, overly broad provider scopes, and side effects inside build methods, which cause memory leaks and unnecessary widget rebuilds. ## Core Features & Use Cases - Disposal Audit: Verifies that every finite-lived state holder is properly disposed. - Immutability & Rebuild Checks: Confirms state objects are immutable and providers are scoped deeply enough to avoid whole-screen rebuilds. - Side Effect Placement: Ensures API calls and navigation happen outside the build method. - Use Case: When refactoring a Flutter screen that rebuilds excessively, run this checklist against its providers to pinpoint scoping and disposal issues before shipping. ## Quick Start Audit the providers in my Flutter feature folder using the state management hygiene checklist and report any violations.

Frequently Asked Questions about state-management-hygiene

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit Flutter providers for memory leaks?▼

Check that every finite-lived state holder, such as a ChangeNotifier or controller, is disposed when no longer needed. Undisposed holders retain listeners and resources, causing memory leaks over time.

How to reduce unnecessary widget rebuilds in Flutter?▼

Scope providers as deeply as possible in the widget tree so only the widgets that depend on changed state rebuild. Broadly scoped providers at the app root trigger whole-screen rebuilds on every state change.

Why should side effects stay outside the Flutter build method?▼

Build methods can run many times per second, so placing API calls or navigation inside them causes duplicate requests and erratic behavior. Side effects belong in lifecycle callbacks, event handlers, or state notifiers.

When should Flutter state objects be immutable?▼

State objects should be immutable whenever the framework compares instances to detect changes, since mutating fields in place prevents change detection from working correctly. Immutable state also makes rebuild behavior predictable and easier to debug.