listen<T> abstract method

void listen<T>(
  1. ProviderListenable<T> provider,
  2. void listener(
    1. T? previous,
    2. T next
    ), {
  3. void onError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
})

Listen to a provider and call listener whenever its value changes.

This is useful for showing modals or other imperative logic.

Implementation

void listen<T>(
  ProviderListenable<T> provider,
  void Function(T? previous, T next) listener, {
  void Function(Object error, StackTrace stackTrace)? onError,
});