StreamProviderRef<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 allow a provider to consume other providers.
- onDispose, a method that allows performing a task when the provider is destroyed.
- StreamProviderRef.state, the value currently exposed by this provider.
- Implemented types
-
- Ref<
AsyncValue< State> >
- Ref<
- Annotations
-
- @Deprecated('will be removed in 3.0.0. Use Ref instead')
Constructors
Properties
- container → ProviderContainer
-
The ProviderContainer that this provider is associated with.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
Methods
-
exists(
ProviderBase< Object?> provider) → bool -
Determines whether a provider is initialized or not.
inherited
-
invalidate(
ProviderOrFamily provider) → void -
Invalidates the state of the provider, destroying the state immediately
and causing the provider to rebuild at some point in the future.
inherited
-
invalidateSelf(
) → void -
Invalidates the state of the provider, causing it to refresh.
inherited
-
keepAlive(
) → KeepAliveLink -
Requests for the state of a provider to not be disposed when all the
listeners of the provider are removed.
inherited
-
listen<
T> (ProviderListenable< T> provider, void listener(T? previous, T next), {void onError(Object error, StackTrace stackTrace)?, bool fireImmediately}) → ProviderSubscription<T> -
Listen to a provider and call
listener
whenever its value changes.inherited -
listenSelf(
void listener(AsyncValue< State> ? previous, AsyncValue<State> next), {void onError(Object error, StackTrace stackTrace)?}) → void -
Listens to changes on the value exposed by this provider.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Notify dependents that this provider has changed.
inherited
-
onAddListener(
void cb()) → void -
A life-cycle for whenever a new listener is added to the provider.
inherited
-
onCancel(
void cb()) → void -
Add a listener to perform an operation when the last listener of the provider
is removed.
inherited
-
onDispose(
void cb()) → void -
Adds a listener to perform an operation right before the provider is destroyed.
inherited
-
onRemoveListener(
void cb()) → void -
A life-cycle for whenever a listener is removed from the provider.
inherited
-
onResume(
void cb()) → void -
A life-cycle for when a provider is listened again after it was paused
(and onCancel was triggered).
inherited
-
read<
T> (ProviderListenable< T> provider) → T -
Read the state associated with a provider, without listening to that provider.
inherited
-
refresh<
T> (Refreshable< T> provider) → T -
Forces a provider to re-evaluate its state immediately, and return the created value.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
watch<
T> (ProviderListenable< T> provider) → T -
Obtains the state of a provider and causes the state to be re-evaluated
when that provider emits a new value.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited