optBool method

bool? optBool(
  1. String key, [
  2. bool? defaultValue
])

returns the value corresponding with key as nullable bool if null returns defaultValue

Implementation

bool? optBool(String key, [bool? defaultValue]) {
  switch (_params[key]?.toLowerCase()) {
    case 'true':
      return true;
    case 'false':
      return false;
    default:
      return defaultValue;
  }
}