archive static method

Map<String, dynamic> archive(
  1. Coding root, {
  2. bool allowReferences = false,
})

Archives a Coding object into a Map that can be serialized into format like JSON or YAML.

Note that the return value of this method, as well as all other Map and List objects embedded in the return value, are instances of KeyedArchive and ListArchive. These types implement Map and List, respectively.

If allowReferences is true, JSON Schema references in the emitted document will be validated. Defaults to false.

Implementation

static Map<String, dynamic> archive(
  Coding root, {
  bool allowReferences = false,
}) {
  final archive = KeyedArchive({});
  root.encode(archive);
  if (allowReferences) {
    archive.resolveOrThrow(ReferenceResolver(archive));
  }
  return archive.toPrimitive();
}