decode method Null safety

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

Implementation

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

  type = object.decode("type") ?? "oauth2";
  description = object.decode("description");

  if (type == "basic") {
  } else if (type == "oauth2") {
    oauthFlow = APISecuritySchemeFlowCodec.decode(object.decode("flow"));
    authorizationURL = object.decode("authorizationUrl");
    tokenURL = object.decode("tokenUrl");
    final scopeMap = object.decode<Map<String, String>>("scopes")!;
    scopes = Map<String, String>.from(scopeMap);
  } else if (type == "apiKey") {
    apiKeyName = object.decode("name");
    apiKeyLocation = APIParameterLocationCodec.decode(object.decode("in"));
  }
}