safeBool static method
安全解析bool类型
Implementation
static bool safeBool(dynamic value, [bool defaultValue = false]) {
if (value is String) {
try {
return bool.parse(value, caseSensitive: false);
} catch (e) {
return false;
}
} else if (value is bool) {
return value;
}
return defaultValue;
}