asBoolOrNull function
Implementation
bool? asBoolOrNull(Object? v) {
if (v == null) return null;
if (v is bool) return v;
if (v is String) {
final s = v.toLowerCase().trim();
if (s == 'true' || s == '1') return true;
if (s == 'false' || s == '0') return false;
}
if (v is num) return v != 0;
return null;
}