encode method Null safety

  1. @override
void encode(
  1. KeyedArchive object
)

Implementation

@override
void encode(KeyedArchive object) {
  object.encode("name", name);
  object.encode("description", description);
  object.encode("in", APIParameterLocationCodec.encode(location));
  object.encode("required", isRequired);

  if (location == APIParameterLocation.body) {
    object.encodeObject("schema", schema);
  } else {
    super.encode(object);
    if (allowEmptyValue) {
      object.encode("allowEmptyValue", allowEmptyValue);
    }
    if (type == APIType.array) {
      object.encodeObject("items", items);
    }
  }
}