watch<N extends StateNotifier<S>, S> method

  1. @override
N watch<N extends StateNotifier<S>, S>(
  1. BaseStateNotifierProvider<N, S> providerOrFilter, {
  2. String? tag,
})
override

read a Notifier from one provider and subscribe the widget to the changes of this Notifier.

providerOrTarget this param is required to decide when the Consumer needs to be rebuilded, if providerOrTarget is a SimpleProvider or a StateProvider the widget will be rebuilded when the notify method is called inside a SimpleNotifier or StateNotifier.

If providerOrTarget is a value gotten from .select, .ids or .when the widget only will be rebuilded depending of the condition of each method.

Implementation

@override
N watch<N extends StateNotifier<S>, S>(
  m.BaseStateNotifierProvider<N, S> providerOrFilter, {
  String? tag,
}) {
  return _buildWatcher(
    providerOrFilter: providerOrFilter,
    tag: tag,
    isListener: false,
    callback: (_) => _rebuild(),
  ); // coverage:ignore-line
}