asBool property

bool get asBool

Returns a boolean representation for this string

Implementation

bool get asBool {
  if (toLowerCase() == "true") {
    return true;
  } else if (toLowerCase() == "false") {
    return false;
  }
  throw FormatException(
    "Invalid string format, couldn't convert to boolean: $this",
  );
}