provider · evanca — Claude Code skill: what it does, how to install
Guides agents on architecting Flutter state with the provider package, keeping rebuilds minimal and dependencies reactive.
MIT ★ 674 updated 2026-10-29
/plugin marketplace add evanca/flutter-ai-rules
/plugin install flutter-ai-skills@flutter-ai-rulesWhat provider does
This skill instructs coding assistants on best practices for the Flutter provider package. It guides the model to select suitable primitives such as ChangeNotifierProvider, StreamProvider, or FutureProvider, bundling them cleanly with MultiProvider.
The guidance enforces clear boundaries for reading state: context.watch stays confined to build methods, while events and callbacks trigger logic strictly via context.read. For selective UI updates, it directs the agent toward context.select, Consumer, and Selector.
Instantiating a provider from values that change over time causes stale states, so the skill mandates ProxyProvider whenever dependencies shift. It also notes that mounting over 150+ providers at once risks a StackOverflowError, advising staged initialization instead.
What it helps with
- Wire dependent models together using
ProxyProviderwithout stale data - Cut down unnecessary UI rebuilds via
Selectorandcontext.select - Migrate away from deprecated
ValueListenableProvider - Prevent runtime crashes by keeping provider reads out of
initState
Example prompts for the agent
- Set up an authentication service and dependent API client using
ProxyProvider - Refactor this screen to consume updates through
context.selectinstead of full rebuilds - Migrate deprecated listener providers to
ValueListenableBuilderwithProvider.value
How to install provider
1Plugin marketplace
/plugin marketplace add evanca/flutter-ai-rules/plugin install flutter-ai-skills@flutter-ai-rulesThis installs the whole flutter-ai-skills plugin with all its skills
2Skills CLI (Vercel)
npx skills add evanca/flutter-ai-rules --skill provider -a claude-code3Manually: put the files in place
~/.claude/skills/provider/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/provider/
1Skills CLI (Vercel)
npx skills add evanca/flutter-ai-rules --skill provider -a codex2Manually: put the files in place
.agents/skills/provider/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add evanca/flutter-ai-rules --skill provider -a cursor2Manually: put the files in place
.cursor/skills/provider/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install evanca/flutter-ai-rules skills/provider2Manually: put the files in place
.github/skills/provider/SKILL.md1Skills CLI (Vercel)
npx skills add evanca/flutter-ai-rules --skill provider -a gemini-cli2Platform CLI
gemini skills install https://github.com/evanca/flutter-ai-rules --path skills/providerManually: put the files in place
.devin/skills/provider/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about provider
How to install provider in Claude Code?
Run both commands in order: /plugin marketplace add evanca/flutter-ai-rules followed by /plugin install flutter-ai-skills@flutter-ai-rules.
What does the provider skill do?
It guides AI tools to generate correct Flutter code with provider, enforcing clean rebuild patterns and proper dependency resolution.
Can providers be accessed inside initState?
No, the skill explicitly bans calling providers inside initState or constructors because the widget tree is not fully mounted yet.
Source text
SKILL.md · MIT
---
name: provider
description: "Use when setting up providers, consuming state, optimizing rebuilds, using ProxyProvider, or migrating from deprecated providers (Provider package)."
license: MIT
---
# Provider Skill
This skill defines how to correctly use the `provider` package in Flutter applications.
---
## 1. Provider Types
| Provider | Use for |
|---|---|
| `Provider` | Exposing any immutable value |
| `ChangeNotifierProvider` | Mutable state with `ChangeNotifier` |
| `FutureProvider` | Exposing a `Future` result |
| `StreamProvider` | Exposing a `Stream` |
| `ProxyProvider` / `ChangeNotifierProxyProvider` | Objects that depend on other providers |
---
## 2. Setup
```dart
MultiProvider(
providers: [
Provider<Something>(create: (_) => Something()),
ChangeNotifierProvider(create: (_) => MyNotifier()),
FutureProvider<String>(create: (_) => fetchData(), initialData: ''),
],
child: MyApp(),
)
```
- Use `MultiProvider` to group multiple providers and avoid deeply nested trees.
- `ChangeNotifierProvider` **automatically disposes** the model when it is no longer needed.
- **Never** create a provider's object from variables that can change over time — the object won't update when the variable changes. Use `ProxyProvider` instead.
- If you have 150+ providers, consider mounting them over time (e.g., during a splash screen) rather than all at once to avoid `StackOverflowError`.
---
## 3. Consuming State
Always specify the **generic type** for type safety:
```dart
// Listen and rebuild on change — only valid inside build() or a Provider's update method
final count = context.watch<MyModel>().count;
// Access without listening — use in callbacks, not inside build()
context.read<MyModel>().increment();
// Listen to only part of the state
final count = context.select<MyModel, int>((m) => m.count);
```
Use `Consumer<T>` or `Selector<T, R>` widgets when you need fine-grained rebuilds and cannot access a descendant `BuildContext`:
```dart
Consumer<MyModel>(
builder: (context, model, child) => Text('${model.count}'),
child: const ExpensiveWidget(), // rebuilt only once
)
Selector<MyModel, int>(
selector: (_, model) => model.count,
builder: (_, count, __) => Text('$count'),
)
```
---
## 4. ProxyProvider
Use `ProxyProvider` or `ChangeNotifierProxyProvider` for objects that depend on other providers or values that can change:
```dart
MultiProvider(
providers: [
Provider<Auth>(create: (_) => Auth()),
ProxyProvider<Auth, Api>(
update: (_, auth, __) => Api(auth.token),
),
],
)
```
---
## 5. Rules
- Do **not** access providers inside `initState` or constructors — use them in `build`, callbacks, or lifecycle methods where the widget is fully mounted.
- You can use **any object** as state, not just `ChangeNotifier`; use `Provider.value()` with a `StatefulWidget` if needed.
---
## 6. Debugging
Implement `toString` or `DiagnosticableTreeMixin` to improve how your objects appear in Flutter DevTools:
```dart
class MyModel with DiagnosticableTreeMixin {
final int count;
MyModel(this.count);
@override
String toString() => 'MyModel(count: $count)';
}
```
---
## 7. Migration: ValueListenableProvider
`ValueListenableProvider` is deprecated. Use `Provider` with `ValueListenableBuilder` instead:
```dart
ValueListenableBuilder<int>(
valueListenable: myValueListenable,
builder: (context, value, _) {
return Provider<int>.value(
value: value,
child: MyApp(),
);
},
)
```
---
## References
- [Provider GitHub Repository](https://github.com/rrousselGit/provider)
© Ivanna Kaceviča · MIT · evanca/flutter-ai-rules
Similar skills
All skills for Mobile →provider by other authors comes first.