toBool method

bool toBool([
  1. bool defaultValue = false
])

Implementation

bool toBool([bool defaultValue = false]) {
  if (toString().compareTo('1') == 0 || toString().compareTo('true') == 0) {
    return true;
  } else if (toString().compareTo('0') == 0 ||
      toString().compareTo('false') == 0) {
    return false;
  }
  return defaultValue;
}