toOnOff method
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';
Converts the boolean to a string representation: 'On' for true, 'Off' for false.
Example:
bool flag = false;
print(flag.toOnOff()); // Output: Off
String toOnOff() => this ? 'On' : 'Off';