toBool static method
Converts a string to a boolean if possible. Accepts "true" or "false" (case-insensitive).
Implementation
static bool? toBool(String input) {
final lower = input.toLowerCase();
if (lower == 'true') return true;
if (lower == 'false') return false;
return null;
}