watch method

ValueListenable<Object?> watch(
  1. String key
)

Watches key. The returned listenable only updates for related paths.

Implementation

ValueListenable<Object?> watch(String key) {
  _ensureActive();
  final normalizedKey = validateStateKey(key);
  return _watchers.putIfAbsent(
    normalizedKey,
    () => ValueNotifier<Object?>(
      _cloneStateValue(_readStatePath(_values, normalizedKey)),
    ),
  );
}