flutter-state-provider

Maintains and migrates legacy Flutter apps built on the Provider 6.x ChangeNotifier pattern.

Updated Jun 13, 2026
One-click install
npx skills add https://github.com/22Teikk/22Teikk-Agent-Skills-Hub --skill flutter-state-provider-22teikk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flutter-state-provider
Source: https://github.com/22Teikk/22Teikk-Agent-Skills-Hub/tree/main/packs/flutter/skills/flutter-state-provider
Command: npx skills add https://github.com/22Teikk/22Teikk-Agent-Skills-Hub --skill flutter-state-provider-22teikk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Legacy Flutter apps built on the Provider 6.x package need ongoing maintenance and a safe migration path to Riverpod, but Provider is in maintenance mode and should not receive new features. This Skill guides correct maintenance of existing ChangeNotifier-based code and incremental per-feature migration to Riverpod without a big-bang rewrite. ## Core Features & Use Cases - Legacy Provider Maintenance: Enforces correct usage of ChangeNotifier, ChangeNotifierProvider, context.watch/read/select, Consumer, MultiProvider, and ProxyProvider, including dispose lifecycle and rebuild scoping. - Provider to Riverpod Migration: Provides a mapping table (ChangeNotifier to Notifier, context.watch to ref.watch, MultiProvider to ProviderScope) and a six-step per-feature conversion process with coexistence of both frameworks during transition. - Testing Guidance: Covers unit-testing notifiers as plain Dart objects and widget-testing with ChangeNotifierProvider.value fakes. - Use Case: You must fix a ProviderNotFoundException and rebuild storm on a cart screen in an app declaring provider ^6.x, then convert that feature to Riverpod while leaving the rest of the app untouched. ## Quick Start Use the flutter-state-provider skill to fix the rebuild storm on my cart screen and migrate that feature from Provider to Riverpod.

Frequently Asked Questions about flutter-state-provider

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

FAQPage Schema
How do I migrate Flutter Provider to Riverpod incrementally?▼

Migrate per feature, never all at once. Place ProviderScope above MultiProvider at the root so both coexist, convert each ChangeNotifier to a Notifier or AsyncNotifier with immutable state, swap context.watch to ref.watch, then delete the feature's MultiProvider entry and record the migration in a note.

What is the difference between context.watch and context.read in Flutter Provider?▼

context.watch subscribes the widget and rebuilds it on every notifyListeners call, and is only legal inside build. context.read fetches the instance without subscribing, making it the correct choice inside callbacks like onPressed and initState.

Should I use Provider for a new Flutter project?▼

No. Provider 6.x is in maintenance mode with no new features planned, and its author steers new work to Riverpod. New features should use Riverpod or BLoC; Provider should only be maintained where it already exists.

Why does ProviderNotFoundException happen in Flutter?▼

ProviderNotFoundException occurs when the requested provider is not an ancestor of the reading BuildContext. Common causes are reading in the same build method that creates the provider, reading above a Navigator push, or scoping the provider to the wrong route.

How do I test a ChangeNotifier in Flutter?▼

Unit-test the notifier as a plain Dart object by adding a listener, calling methods, and asserting state and notification counts. For widget tests, wrap the widget under test in ChangeNotifierProvider.value with a fake instance so the test owns its lifetime.

When should I keep Provider instead of migrating to Riverpod?▼

Keep Provider when the app is near end-of-life with no new features expected, or for read-only legacy screens with no planned changes. Convert a screen only when a change touches it, paying the migration cost as a per-feature tax.