encode method Null safety

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

Implementation

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

  if (!info.isValid || paths == null) {
    throw ArgumentError(
      "APIDocument must have values for: 'version', 'info' and 'paths'.",
    );
  }

  object.encode("openapi", version);
  object.encodeObject("info", info);
  object.encodeObjects("servers", servers);
  object.encodeObjectMap("paths", paths);
  object.encodeObject("components", components);
  object.encodeObjects("security", security);
  object.encodeObjects("tags", tags);
}