listenManual<T> abstract method
ProviderSubscription<T>
listenManual<T>(
- ProviderListenable<
T> provider, - void listener(
- T? previous,
- T next
- void onError(
- Object error,
- StackTrace stackTrace
- bool fireImmediately,
Listen to a provider and call listener
whenever its value changes.
As opposed to listen, listenManual is not safe to use within the build
method of a widget.
Instead, listenManual is designed to be used inside State.initState or
other State lifecycles.
listenManual returns a ProviderSubscription which can be used to stop listening to the provider, or to read the current value exposed by the provider.
It is not necessary to call ProviderSubscription.close inside State.dispose. When the widget that calls listenManual is disposed, the subscription will be disposed automatically.
Implementation
ProviderSubscription<T> listenManual<T>(
ProviderListenable<T> provider,
void Function(T? previous, T next) listener, {
void Function(Object error, StackTrace stackTrace)? onError,
bool fireImmediately,
});