toggle method

bool toggle()

Toggles the boolean value.

If the value is true, it returns false. If the value is false, it returns true.

Example:

bool value = true;
print(value.toggle()); // false
value = false;
print(value.toggle()); // true

Implementation

bool toggle() => !this;