boolean static method

Map<String, Object> boolean(
  1. bool boolean,
  2. String name, {
  3. bool defaultValue = false,
  4. bool useDefaultValue = false,
  5. bool allowNull = false,
})

Implementation

static Map<String, Object> boolean(bool boolean, String name,
    {bool defaultValue = false,
    bool useDefaultValue = false,
    bool allowNull = false}) {
  if (useDefaultValue && allowNull) {
    throw LooseException(
        'Cannot allow null and use default value for "$name". Must only use one or neither.');
  }
  if (boolean != null) {
    return {'booleanValue': boolean};
  } else if (allowNull) {
    return _toNullValue;
  } else if (useDefaultValue) {
    return {'booleanValue': defaultValue};
  } else {
    throw LooseException('Null provided but not allowed in "$name".');
  }
}