Dumping YAML Documents topic
You can dump documents by calling dumpYamlDocuments. This package exposes YamlDocument which can only be constructed when an object is parsed. This is intentional. The root node of the YamlDocument will be dumped as a CompactYamlNode.
const source = '''
%TAG !reproducible! !reproducible
---
!reproducible!sequence [
  !!str &anchor value,
  *anchor ,
  !tag [ *anchor , 24 ],
]
''';
print(
  dumpYamlDocuments(
    loadAllDocuments(source: source),
  ),
);
# Output in yaml
%YAML 1.2
%TAG !reproducible! !reproducible
---
!reproducible!sequence [
 &anchor !!str value,
 *anchor ,
 !tag [
  *anchor ,
  !!int 24
 ]
]
...
Classes
- YamlDocument Loading a YamlDocument Dumping YAML Documents
- 
  A document representing the entire YAMLstring or a single scalar/collection node within a group of documents inYAML.
Functions
- 
  dumpCompactNode<N extends CompactYamlNode> (N node, {required Object? nodeUnpacker(N node)?, ScalarStyle scalarStyle = ScalarStyle.plain}) → String Dumping YAML Nodes Dumping YAML Documents
- 
  Dumps a nodewith its properties if any are present. Any CompactYamlNode subtype that is not a Mapping, Sequence or Scalar should define anodeUnpackerfunction that prevents thenodefrom being dumped as a Scalar.
- 
  dumpYamlDocuments(Iterable< Dumping YAML DocumentsYamlDocument> documents, {ScalarStyle scalarStyle = ScalarStyle.plain}) → String
- 
  Dumps a collection of YAML documentswith its directives if any are present. The YamlDocument's root node is also dumped with its properties such that all TagShorthands are linked to their respective GlobalTag directives and aliases "compressed" as anchors if possible.