Skip to content
pubscout

disposable_provider

2.5.0, released 9 days ago by mono0926.com

A thin wrapper around Provider that automatically calls dispose.

WASM-ready
$ flutter pub add disposable_provider
Source repository

What it does

DisposableProvider extends the standard Provider package functionality by automatically calling dispose on provided objects when they are removed from the tree. It helps manage resources without requiring manual cleanup boilerplate.

AI-written summary of version 2.4.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are already using the provider package and need automatic disposal of provided objects.
  • You want a lightweight wrapper to handle resource cleanup for state objects.

Skip it when

  • You are using modern state management alternatives like Riverpod or Bloc that handle disposal natively.
  • You do not use the provider package in your application.

Strengths

  • Automates the disposal of provided objects
  • Acts as a thin, seamless wrapper around the standard Provider

Weaknesses

  • Tied directly to the lifecycle and ecosystem of the provider package
  • Limited documentation beyond the basic example

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
not documented

Alternatives

Packages that do the same job and could replace disposable_provider.

  • flutter_riverpod

    A modern and robust alternative to provider that natively handles auto-disposal and provider lifecycles.

  • flutter_bloc

    A predictable state management library that automatically disposes blocs and cubits.

Works with

Packages commonly used together with disposable_provider: ones it builds on, ones built on it, and its own family.