parseBool method

bool parseBool()

Implementation

bool parseBool() {
  try {
    if (this is bool) return this as bool;
    if (this is num) return (this as num) != 0;
    final str = toString().trim().toLowerCase();
    return !(str.isEmpty || str == "0" || str == "false" || str == "null");
  } catch (e) {
    return false;
  }
}