watch<T> static method

T watch<T>(
  1. BuildContext context,
  2. ProviderListenable<T> target
)

This will get the inherited element and call the dependOnInheritedElement method. The element will decide when to rebuild the provided context

Implementation

static T watch<T>(BuildContext context, ProviderListenable<T> target) {
  _ensureDebugDoingBuild(context, 'watch');

  var elem = _getElementOrThrow(context);
  context.dependOnInheritedElement(elem);
  return elem._watch(context, target);
}