decode method Null safety

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

Implementation

@override
void decode(KeyedArchive object) {
  name = object.decode("name");
  description = object.decode("description");
  location = APIParameterLocationCodec.decode(object.decode("in"));
  if (location == APIParameterLocation.path) {
    isRequired = true;
  } else {
    isRequired = object.decode("required") ?? false;
  }

  if (location == APIParameterLocation.body) {
    schema = object.decodeObject("schema", () => APISchemaObject());
  } else {
    super.decode(object);
    allowEmptyValue = object.decode("allowEmptyValue") ?? false;
    if (type == APIType.array) {
      items = object.decodeObject("items", () => APIProperty());
    }
  }
}