listen<T> abstract method
- ProviderListenable<
T> provider, - void listener(
- T? previous,
- T next
- {bool fireImmediately,
- void onError(
- Object error,
- StackTrace stackTrace
override
Listen to a provider and call listener
whenever its value changes.
Listeners will automatically be removed when the provider rebuilds (such as when a provider listeneed with watch changes).
Returns a function that allows cancelling the subscription early.
fireImmediately
can be optionally passed to tell Riverpod to immediately call the listener with the current value. Defaults to false.
Implementation
@override
void Function() listen<T>(
// overridden to allow AutoDisposeProviderBase
ProviderListenable<T> provider,
void Function(T? previous, T next) listener, {
bool fireImmediately,
void Function(Object error, StackTrace stackTrace)? onError,
});