toYamlString function

String toYamlString(
  1. dynamic node, {
  2. bool? sort,
})

Serializes node into a String and returns it.

Implementation

String toYamlString(node, {bool? sort}) {
  var sb = StringBuffer();
  _sort = sort ?? false;
  writeYamlString(node, sb);

  /// moves text to be inline with [hyphen '-']
  return sb.toString().replaceAll(RegExp(r'-\s\n\s*'), '- ');
}