decode method Null safety

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

Implementation

@override
void decode(KeyedArchive object) {
  super.decode(object);

  type = APISecuritySchemeTypeCodec.decode(object.decode("type"));
  description = object.decode("description");

  switch (type) {
    case APISecuritySchemeType.apiKey:
      {
        name = object.decode("name");
        location = APIParameterLocationCodec.decode(object.decode("in"));
      }
      break;
    case APISecuritySchemeType.oauth2:
      {
        flows = object.decodeObjectMap(
          "flows",
          () => APISecuritySchemeOAuth2Flow.empty(),
        );
      }
      break;
    case APISecuritySchemeType.http:
      {
        scheme = object.decode("scheme");
        format = object.decode("bearerFormat");
      }
      break;
    case APISecuritySchemeType.openID:
      {
        connectURL = object.decode("openIdConnectUrl");
      }
      break;
    default:
      throw ArgumentError(
        "APISecurityScheme must have non-null values for: 'type'.",
      );
  }
}