AutoDisposeRef class Null safety

A Ref for providers that are automatically destroyed when no-longer used.

The difference with Ref is that it has an extra maintainState property, to help determine if the state can be destroyed or not.

Inheritance
Implementers

Constructors

AutoDisposeRef()

Properties

container ProviderContainer
The ProviderContainer that this provider is associated with.
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
maintainState bool
Whether to destroy the state of the provider when all listeners are removed or not. [...]
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

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. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onDispose(void cb()) → void
Adds a listener to perform an operation right before the provider is destroyed. [...]
inherited
read<T>(ProviderBase<T> provider) → T
Read the state associated with a provider, without listening to that provider. [...]
inherited
refresh<State>(ProviderBase<State> provider) → State
Re-create the state of a provider and return the new state.
inherited
toString() String
A string representation of this object. [...]
inherited
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. [...]
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited