watch method

T watch(
  1. WatcherRef ref
)

Starts watching this object for changes (i.e. Listenable.addListener) and rebuilds the widget associated with the provided WatcherRef whenever listeners are notified.

NOTE: This method must only be called from within the build method of a WatcherWidget, or a Widget that mixes in WatcherMixin / StatefulWatcherMixin.

Returns the current value of this ValueListenable.

Implementation

T watch(WatcherRef ref) {
  ref.watch(this);
  return value;
}