isBool static method
Dynamic check for a boolean from a String/bool
Implementation
static bool isBool(dynamic b) {
try {
if (b == null) return false;
if (b is bool) return true;
b = b.toString();
b = b.trim().toLowerCase();
return ((b == 'false') ||
(b == '0') ||
(b == 'no') ||
(b == 'true') ||
(b == '1') ||
(b == 'yes'));
} catch (e) {
return false;
}
}