optBoolean method

bool optBoolean(
  1. String name, {
  2. bool fallback = false,
})

Returns the value mapped by {@code name} if it exists and is a boolean or can be coerced to a boolean, or {@code fallback} otherwise.

Implementation

bool optBoolean(String name, {bool fallback = false}) {
  dynamic object = opt(name);
  return _toBoolean(object) ?? fallback;
}