mobile-flutter-state-management

Implement Riverpod, Bloc, or Provider state management in Flutter apps.

2|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/TMHSDigital/Mobile-App-Developer-Tools --skill mobile-flutter-state-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mobile-flutter-state-management
Source: https://github.com/TMHSDigital/Mobile-App-Developer-Tools/tree/main/skills/mobile-flutter-state-management
Command: npx skills add https://github.com/TMHSDigital/Mobile-App-Developer-Tools --skill mobile-flutter-state-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers choose and implement the right state management approach for Flutter apps so application state is predictable, testable, and scalable across screens and asynchronous data flows.

Core Features & Use Cases

  • Decision guidance: A decision matrix mapping simple local state to setState, shared and async state to Riverpod, and complex event-driven flows to Bloc/Cubit.
  • Practical implementation steps: Installation and integration patterns, ProviderScope usage, code generation with riverpod_generator and build_runner, and AsyncNotifier patterns for API-backed state.
  • Testing and pitfalls: Recommendations for testing providers/blocs, common mistakes (ref.read vs ref.watch, missing ProviderScope, mutable states), and migration notes for Provider-based codebases.
  • Use case example: Managing a shopping cart shared across screens with add/remove operations, persisted async fetches, and UI badges that update automatically.

Quick Start

Create a Riverpod CartNotifier with add, remove, and clear methods, wrap the app in ProviderScope, and use ref.watch(cartProvider) in the cart screen to display the item count.

Frequently Asked Questions about mobile-flutter-state-management

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

FAQPage Schema
What's the best way to manage state in Flutter across multiple screens?

For shared cross-screen state in Flutter, Riverpod is recommended for predictable and scalable architecture, while Bloc is suited for complex event-driven flows. The Skill provides a decision matrix to choose between setState, Riverpod, and Bloc based on your app's needs.

How do I handle asynchronous API data with Riverpod in Flutter?

To handle asynchronous API data with Riverpod, use AsyncNotifier patterns. This Skill provides integration steps for AsyncNotifier to manage API-backed state, ensuring data fetches are persisted and UI updates automatically when the async state changes.

Should I use Riverpod, Bloc, or Provider for my Flutter app?

Choose Riverpod for shared and async state, Bloc for complex event-driven architectures, and setState for simple widget-local state. This Skill offers a decision matrix mapping each approach to specific use cases, including migration notes for Provider-based codebases.

How to set up riverpod_generator and build_runner for Flutter state management?

Set up riverpod_generator and build_runner by installing the dependencies and running code generation commands to create provider boilerplate. This Skill outlines the installation, integration patterns, and code generation steps needed to streamline Riverpod usage.

Why does ref.watch cause rebuild issues in Flutter Riverpod?

Using ref.read inside a build method instead of ref.watch is a common mistake that prevents UI updates. This Skill covers testing best practices and pitfalls like missing ProviderScope, mutable states, and incorrect ref usage to ensure predictable state.