parseBool static method
Attempts to parse a value to a boolean.
Accepts various formats:
"true"or"false"1or0trueorfalse
Returns false if value is unrecognized.
Implementation
static bool parseBool(dynamic value) {
if (value is bool) return value;
if (value is String) return value.toLowerCase() == 'true';
if (value is num) return value == 1;
return false;
}