call<T> method

  1. @defineHook
Until<T> call<T>(
  1. ReadableNode<T> source,
  2. bool predicate(
    1. T value
    ), {
  3. bool? detach,
})

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 observe
  • predicate: Returns true when the condition is met
  • detach: 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));
}