bindComputed<T> function

  1. @Deprecated('use SignalsMixin > bindComputed instead')
Computed<T> bindComputed<T>(
  1. BuildContext context,
  2. Computed<T> target, {
  3. String? debugLabel,
})

Bind an existing computed to a widget.

class State extends ... {
 late final count = createSignal(context, 0);
 late final isEven = computed(() => count().isEven);
 late final even = bindComputed(context, isEven);

 @override
 Widget build(BuildContext context) {
   return Row(
    children: [
      IconButton(icon: Icon(Icons.remove), onPressed: () => count.value--),
      Text('$count, even=$even'),
      IconButton(icon: Icon(Icons.add), onPressed: () => count.value++),
   ],
  );
 }
}

Implementation

@Deprecated('use SignalsMixin > bindComputed instead')
Computed<T> bindComputed<T>(
  BuildContext context,
  Computed<T> target, {
  String? debugLabel,
}) {
  return bindSignal<T, Computed<T>>(
    context,
    target,
    debugLabel: debugLabel,
  );
}