parseBoolean static method
Parses a string to a Boolean.
Returns true if the string equals "true" (case-insensitive), false otherwise.
str
the string to parse
Example:
Boolean a = Boolean.parseBoolean("true"); // true
Boolean b = Boolean.parseBoolean("TRUE"); // true
Boolean c = Boolean.parseBoolean("false"); // false
Boolean d = Boolean.parseBoolean("xyz"); // false
A wrapper class for bool that provides Java-like functionality and methods.
This class wraps Dart's primitive bool type and provides additional utility methods similar to Java's Boolean class.
Example usage:
Boolean a = Boolean(true);
Boolean b = Boolean.valueOf(false);
Boolean c = Boolean.parseBoolean("true");
print(a.toString()); // "true"
print(a.compareTo(b)); // 1 (true > false)
Implementation
static Boolean parseBoolean(String str) {
return Boolean(str.toLowerCase() == 'true');
}