toOnOff method

String toOnOff()

Converts the boolean to a string representation: 'On' for true, 'Off' for false.

Example:

bool flag = false;
print(flag.toOnOff()); // Output: Off

Implementation

String toOnOff() => this ? 'On' : 'Off';