asBoolSafe method
Safely converts this string to a boolean
Recognizes various string representations:
- true: 'true', 'yes', 'y', '1', 'on', 'enabled'
- false: 'false', 'no', 'n', '0', 'off', 'disabled'
fallback
The value to return if conversion fails (defaults to null)
Returns the parsed boolean or fallback if conversion fails
Example:
print('true'.asBoolSafe()); // true
print('yes'.asBoolSafe()); // true
print('invalid'.asBoolSafe(false)); // false
Implementation
bool? asBoolSafe([bool? fallback]) {
return QTypeConversion.toBoolSafe(this, fallback);
}