toBool static method

bool toBool(
  1. String? s, {
  2. bool defaultValue = false,
})

Implementation

static bool toBool(String? s, {bool defaultValue = false}) {
  if (s == null) return false;
  try {
    return s == '1' || s.toLowerCase() == 'true';
  } catch (e) {
    return defaultValue;
  }
}