useComputed top-level constant
JoltComputedHookCreator
const useComputed
Creates a computed signal hook that derives its value from other signals.
A computed signal automatically recalculates its value when any of its dependencies change. It's read-only and provides efficient caching.
Parameters:
value: Function that computes the derived valuekeys: Optional keys for hook memoizationdebug: Optional debug options
Returns: A Computed that automatically updates when dependencies change
Example:
Widget build(BuildContext context) {
final firstName = useSignal('John');
final lastName = useSignal('Doe');
final fullName = useComputed(() => '${firstName.value} ${lastName.value}');
return Text('Hello, ${fullName.value}');
}
Implementation
const useComputed = JoltComputedHookCreator._();