toBooleanN static method
Converts a dynamic value to a nullable boolean.
d
- The dynamic value to be converted.
Returns a boolean if the conversion is successful, otherwise null.
Implementation
static bool? toBooleanN(dynamic d) {
if (d is bool) {
return d;
}
if (d is String) {
return d.toLowerCase() == 'true';
}
return null;
}