watch method

T watch(
  1. BuildContext context
)

Registers context to explicitly rebuild when the pod value changes.

Implementation

T watch(BuildContext context) {
  final scope = context
      .dependOnInheritedWidgetOfExactType<WhaleListenerScopeProvider>();

  if (scope == null || scope.listener == null) {
    if (kDebugMode) {
      print(
          'BlueWhale WARNING: WhalePod<${T.toString()}>.watch(context) was called '
          'outside of a WhaleSurface or WhaleBuilder listening scope.');
    }
  } else {
    scope.listener!.listenTo<T>(this);
  }

  return value;
}