toBoolNullable method
Converts a case-insensitive string of 'true' or 'false' to a boolean. Returns null if the string is empty or not 'true' or 'false'. Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
bool? toBoolNullable() {
final String lower = toLowerCase();
if (lower == 'true') {
return true;
}
if (lower == 'false') {
return false;
}
return null;
}