watchSignal<T> function

T watchSignal<T>(
  1. BuildContext context,
  2. ReadonlySignal<T> signal, {
  3. String? debugLabel,
})

Watch a signal value and rebuild the context of the Element if mounted and mark it as dirty

Implementation

T watchSignal<T>(
  BuildContext context,
  ReadonlySignal<T> signal, {
  String? debugLabel,
}) {
  _watch(context, signal, false, _rebuild, debugLabel);
  // Grab the current value without subscribing
  return signal.peek();
}