BoolWatcherExtension extension

BoolWatcherExtension

Extension on Watcher<bool> providing additional boolean-specific functionalities. This extension simplifies toggling and other boolean operations directly on the Watcher without the need to perform actions in the value itself.

Example:

final boolWatcher = true.watcher;
boolWatcher.toggle(); // Toggles the boolean value.
on

Methods

conditionalToggle({required bool condition}) → void
toggle the value of the Watcher based on a condition.
delayedToggle(Duration delay) Future<void>
toggle after a specific time.
setFalse() → void
make the value of the Watcher false
setTrue() → void
make the value of the Watcher true
toggle() → void
toggle the value of the Watcher
toggleWithCallback(VoidCallback callback) → void
toggle the value of the Watcher and run the provided function.

Operators

operator &(bool other) bool
The logical conjunction ("and") of this and other.
operator ^(bool other) bool
The logical exclusive disjunction ("exclusive or") of this and other.
operator |(bool other) bool
The logical disjunction ("inclusive or") of this and other.