call<T> method
Creates an Until hook that waits for source to satisfy predicate.
The returned Until implements Future and completes when the predicate
returns true for the current value. Automatically cancels when the widget
unmounts.
Parameters:
source: The reactive value to observepredicate: Returnstruewhen the condition is metdetach: If true, the underlying effect is not bound to the current scope
Returns: An Until that can be awaited; call Until.cancel to stop waiting
Example:
setup(context, props) {
final count = useSignal(0);
final until = useUntil(count, (v) => v >= 5);
onMounted(() async {
final result = await until;
print('Reached: $result');
});
return () => Text('Count: ${count.value}');
}
Implementation
@defineHook
Until<T> call<T>(
ReadableNode<T> source,
bool Function(T value) predicate, {
bool? detach,
}) {
return useHook(_UseUntilHook<T>(source, predicate, detach: detach));
}