Signals are the cornerstone of reactivity in solidart. They contain values that change over time; when you change a signal's value, it automatically updates anything that uses it.

Let's see how to create a Signal:

Next create the signal with:

final counter = Signal(0);

The argument passed to the create call is the initial value, and the return value is the signal.

To retrieve the current value, you can use:

print(counter.value); // prints 0
// or

To change the value, you can use:

// Increments by 1
// Set the value to 2
counter.value = 2;
// equivalent to
// Update the value based on the current value
counter.updateValue((value) => value * 2);