dynamicToBool static method
Implementation
static bool? dynamicToBool(dynamic value) {
if (value == null) return null;
if (value is bool) return value;
if (value is int) {
if (value == 1) return true;
if (value == 0) return false;
return null;
}
if (value is String && value.isNotEmpty) {
final String lower = value.toNormalize();
if (lower == "true") return true;
if (lower == "false") return false;
return null;
}
return null;
}