encode method Null safety

void encode(
  1. KeyedArchive object
)
override

Implementation

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

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

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