riverpod-auto-dispose

Enable automatic disposal of Riverpod providers when they have no active listeners.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/dangdungvn/review_system_app --skill riverpod-auto-dispose-dangdungvn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod-auto-dispose
Source: https://github.com/dangdungvn/review_system_app/tree/main/.github/skills/riverpod-auto-dispose
Command: npx skills add https://github.com/dangdungvn/review_system_app --skill riverpod-auto-dispose-dangdungvn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps prevent memory leaks and unnecessary resource consumption in Riverpod applications by automatically disposing of providers when they are no longer actively used.

Core Features & Use Cases

  • Automatic Disposal: Providers are automatically cleaned up when they have no listeners, freeing up memory.
  • Resource Management: Ensures that resources like streams or controllers are properly closed when a provider is disposed.
  • Use Case: When building a complex UI with many stateful components, this Skill ensures that the state associated with components that are no longer visible or interacted with is efficiently released, improving app performance and stability.

Quick Start

Use the riverpod-auto-dispose skill to enable automatic disposal for the 'helloWorld' provider.

Frequently Asked Questions about riverpod-auto-dispose

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

FAQPage Schema
How do I prevent memory leaks in Flutter Riverpod providers?

To prevent memory leaks in Flutter Riverpod, enable auto-dispose to automatically clean up providers when they have no active listeners. This ensures efficient caching and releases resources associated with unused stateful components.

How does auto-dispose work for Riverpod provider lifecycle management?

Auto-dispose manages the Riverpod provider lifecycle by automatically disposing of providers when they no longer have active listeners. This mechanism handles resource cleanup and prevents unnecessary memory consumption in your application.

Can I use code generation to configure auto-dispose in Riverpod?

Yes, Riverpod auto-dispose supports both manual and code-generation configurations for enabling automatic disposal. You can use code generation to enable automatic disposal for providers like 'helloWorld' to streamline state lifecycle management.

When should I use auto-dispose for Riverpod state management?

You should use auto-dispose for Riverpod state management when building complex UIs with many stateful components. It efficiently releases state, closes streams or controllers, and improves app performance when components are no longer visible or interacted with.

Does Riverpod auto-dispose handle resource cleanup for streams and controllers?

Yes, Riverpod auto-dispose handles resource cleanup by ensuring that resources like streams or controllers are properly closed when a provider is disposed. This prevents memory leaks and optimizes resource management in your Flutter application.