set method
Sets a new value for the signal.
Parameters:
value: The new value to set
This will notify all subscribers if the value has changed.
Example:
final counter = Signal(0);
counter.set(10); // Notifies subscribers
Implementation
@override
void set(T value) {
super.set(value);
hasInitialized = true;
_version++;
if (writeDelay != Duration.zero) {
_timer?.cancel();
_timer = Timer(writeDelay, () async {
try {
await write(value);
} catch (e, s) {
Zone.current.handleUncaughtError(e, s);
} finally {
_timer = null;
}
});
} else {
write(value);
}
}