signal<T> function

WritableSignal<T> signal<T>(
  1. T value
)

Creates a new signal with the given initial value.

A signal is a reactive value that can be read and written to. When the value changes, any computed values or effects that depend on it will automatically update.

Example:

final count = signal(0);
effect(() {
  print('Count is: ${count()}');
});
count(1); // Prints: Count is: 1

Implementation

WritableSignal<T> signal<T>(T value) => _WritableSignal(value);