lazy<T> method

Signal<T> lazy<T>({
  1. JoltDebugFn? onDebug,
})

Creates a lazy signal hook without an initial value.

Parameters:

  • onDebug: Optional debug callback for reactive system debugging

Returns: A Signal that can be read and written to

Example:

setup(context, props) {
  final data = useSignal.lazy<String>();

  onMounted(() {
    // Set value later
    data.value = 'loaded data';
  });

  return () => Text(data.peek ?? 'Loading...');
}

Implementation

Signal<T> lazy<T>({
  JoltDebugFn? onDebug,
}) {
  return useAutoDispose(() => Signal.lazy(onDebug: onDebug));
}