list static method

Map<String, Object> list(
  1. List<Map<String, Object>> values,
  2. String name, {
  3. List<Map<String, Object>> defaultValue = const [],
  4. bool useDefaultValue = false,
  5. bool allowNull = false,
})

Implementation

static Map<String, Object> list(List<Map<String, Object>> values, String name,
    {List<Map<String, Object>> defaultValue = const [],
    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 (values != null) {
    return {
      'arrayValue': {'values': values}
    };
  } else if (allowNull) {
    return _toNullValue;
  } else if (useDefaultValue) {
    return {
      'arrayValue': {'values': defaultValue}
    };
  } else {
    throw LooseException('Null provided but not allowed in "$name".');
  }
}