disposable_provider
2.5.0, released 9 days ago by mono0926.com
A thin wrapper around Provider that automatically calls dispose.
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 documentedAlternatives
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.
93Compare - flutter_bloc
A predictable state management library that automatically disposes blocs and cubits.
86Compare
Works with
Packages commonly used together with disposable_provider: ones it builds on, ones built on it, and its own family.
- providerdisposable_provider depends on itA lightweight wrapper around InheritedWidget for state management
- route_observer_mixinBuilt on disposable_providerMixin and provider that expose RouteObserver callbacks like didPush and didPop for easy use.
- firestore_refBuilt on disposable_providerCross-platform Firestore type-safe reference and document wrapper.