WidgetRef class abstract

An object that allows widgets to interact with providers.

Implementers

Constructors

WidgetRef()

Properties

context BuildContext
The BuildContext of the widget associated to this WidgetRef.
read-only
hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

exists(ProviderBase<Object?> provider) bool
Determines whether a provider is initialized or not.
invalidate(ProviderOrFamily provider) → void
Invalidates the state of the provider, causing it to refresh.
listen<T>(ProviderListenable<T> provider, void listener(T? previous, T next), {void onError(Object error, StackTrace stackTrace)?}) → void
Listen to a provider and call listener whenever its value changes, without having to take care of removing the listener.
listenManual<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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<T>(ProviderListenable<T> provider) → T
Reads a provider without listening to it.
refresh<State>(Refreshable<State> provider) → State
Forces a provider to re-evaluate its state immediately, and return the created value.
toString() String
A string representation of this object.
inherited
watch<T>(ProviderListenable<T> provider) → T
Returns the value exposed by a provider and rebuild the widget when that value changes.

Operators

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