encode method

void encode(
  1. DecodedMetadata metadata,
  2. Output output
)

Implementation

void encode(DecodedMetadata metadata, Output output) {
  //
  // encode magic number
  U32Codec.codec.encodeTo(0x6174656d, output);

  //
  // encode version
  U8Codec.codec
      .encodeTo(metadata.version == 10 ? 9 : metadata.version, output);

  final typeRegistry = RegistryCreator.instance[metadata.version];

  ScaleCodec(typeRegistry)
      .encodeTo('MetadataV${metadata.version}', metadata.metadata, output);
}