toBool method

bool toBool()

Convert a string to boolean.

Implementation

bool toBool() {
  if (toLowerCase() == "true" || toLowerCase() == "1") {
    return true;
  }
  if (toLowerCase() == "false" || toLowerCase() == "0") {
    return false;
  }
  throw UnsupportedError("Cannot convert $this to a boolean");
}