flutter-change-notifier
Use when setting up ChangeNotifier models, providing them to the widget tree, consuming state with Consumer or Provider.of, or optimizing rebuilds.
npx skills add evanca/flutter-ai-rules --skill flutter-change-notifier --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Flutter ChangeNotifier Skill This skill defines how to correctly use `ChangeNotifier` with the `provider` package for state management in Flutter. --- ## 1. Model Extend `ChangeNotifier` to manage state. Keep internal state **private** and expose **unmodifiable views**. Call `notifyListeners()` on every state change. ```dart class CartModel extends ChangeNotifier { final List<Item> _items = []; UnmodifiableListView<Item> get items => UnmodifiableListView(_items); void add(Item item) { _items.add(item); notifyListeners(); } void removeAll() { _items.clear(); notifyListeners(); } } ``` - Place shared state **above** the widgets that use it in the widget tree. - Never directly mutate widgets or call methods on them to change state — rebuild widgets with new data instead. --- ## 2. Providing the Model ```dart ChangeNotifierProvider( create: (context) => CartModel(), child: MyApp(), ) ``` - `ChangeNotifierProvider` **automatically disposes** of the model when it is no longer needed. - Use `MultiProvider` when you need to provide multiple models: ```dart MultiProvider( providers: [ ChangeNotifierProvider(create: (_) => CartModel()), ChangeNotifierProvider(create: (_) => UserModel()), ]
- 1. Model
- 2. Providing the Model
- 3. Consuming State
- Consumer
- Provider.of with listen: false
- 4. Optimization Rules
- 5. Testing
- References
What does the flutter-change-notifier skill do?
Use when setting up ChangeNotifier models, providing them to the widget tree, consuming state with Consumer or Provider.of, or optimizing rebuilds.
How do I install it?
Run `npx skills add evanca/flutter-ai-rules --skill flutter-change-notifier --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From evanca/flutter-ai-rules, a repository with 604 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
