decode method Null safety

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

Implementation

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

  version = object["swagger"] as String;
  host = object["host"] as String?;
  basePath = object["basePath"] as String?;
  schemes = removeNullsFromList(object["schemes"] as List<String?>?);

  /// remove
  consumes = removeNullsFromList(object["consumes"] as List<String?>?);
  produces = removeNullsFromList(object["produces"] as List<String?>?);
  security = object["security"] as List<Map<String, List<String?>>?>;

  info = object.decodeObject("info", () => APIInfo());
  tags = object.decodeObjects("tags", () => APITag());
  paths = object.decodeObjectMap("paths", () => APIPath());
  responses = object.decodeObjectMap("responses", () => APIResponse());
  parameters = object.decodeObjectMap("parameters", () => APIParameter());
  definitions =
      object.decodeObjectMap("definitions", () => APISchemaObject());
  securityDefinitions = object.decodeObjectMap(
    "securityDefinitions",
    () => APISecurityScheme(),
  );
}