Computed API docs

A special Signal that notifies only whenever the selected values change.

A Computed extends a ReadSignal, so all the API of ReadSignal are available.

Constructor

Computed(
  T Function() selector, {
  SignalOptions<T>? options,
});

selector is the function used to compute the value of the signal.

options are the options of the signal.

final count = Signal(1);
final doubleCount = Computed(() => count() * 2);
print(doubleCount()); // prints 2
count.set(2);
print(doubleCount()); // prints 4