stringToBool function

bool? stringToBool(
  1. String? str
)

Implementation

bool? stringToBool(String? str) {
  if (str == null) {
    return null;
  }
  if (str.trim().toLowerCase() == 'false') {
    return false;
  }
  if (str.trim().toLowerCase() == 'true') {
    return true;
  }
  return null;
}