stringToBool static method
Converts a string to a boolean value.
Implementation
static bool? stringToBool(String? value) {
if(TextUtils.isEmptyOrNull(value)) {
return null;
}
String lowercaseValue = value!.toLowerCase().trim();
if (lowercaseValue == "true") {
return true;
} else if (lowercaseValue == "false") {
return false;
} else {
return null;
}
}