AutoDisposeFutureProviderRef<State> class abstract

An object used by providers to interact with other providers and the life-cycles of the application.

See also:

  • read and watch, two methods that allows a provider to consume other providers.
  • onDispose, a method that allows performing a task when the provider is destroyed.
  • ProviderRef.state, the value currently exposed by this providers.
Implemented types


container ProviderContainer
The ProviderContainer that this provider is associated with.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
maintainState bool
Whether to destroy the state of the provider when all listeners are removed or not.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state AsyncValue<State>
Obtains the state currently exposed by this provider.
getter/setter pair


listen<T>(ProviderListenable<T> provider, void listener(T? previous, T next), {bool fireImmediately, void onError(Object error, StackTrace stackTrace)?}) → void Function()
Listen to a provider and call listener whenever its value changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
onDispose(void cb()) → void
Adds a listener to perform an operation right before the provider is destroyed.
read<T>(ProviderBase<T> provider) → T
Read the state associated with a provider, without listening to that provider.
refresh<State>(ProviderBase<State> provider) → State
Re-create the state of a provider and return the new state.
toString() String
A string representation of this object.
watch<T>(ProviderListenable<T> provider) → T
Obtains the state of a provider and cause the state to be re-evaluated when that provider emits a new value.


operator ==(Object other) bool
The equality operator.