useWatch<T> function
Reactive read of a single field's value. Subscribes only to that field's ValueListenable — other field changes do not trigger a rebuild here.
Implementation
T? useWatch<T>(String name, {ZardFormController? form, T? defaultValue}) {
final context = useContext();
final resolved = form ?? ZardFormScope.of(context);
final controller = useMemoized(
() => resolved.register<T>(name, defaultValue: defaultValue),
[resolved, name],
);
final state = useValueListenable(controller.state);
return state.value;
}