Clone this repo:
  1. 9b9d33c Bump actions/checkout from 4.1.0 to 4.1.1 (#61) by dependabot[bot] · 5 weeks ago main
  2. b71c2e8 Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#60) by dependabot[bot] · 5 weeks ago
  3. a7e7fba Bump actions/checkout from 3.6.0 to 4.1.0 (#58) by dependabot[bot] · 9 weeks ago
  4. f33e3d0 Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#59) by dependabot[bot] · 9 weeks ago
  5. 8a380e8 Change AliasError to AliasException (#57) by Sigurd Meldgaard · 10 weeks ago

Dart CI pub package package publisher Coverage Status

A library for YAML manipulation while preserving comments.


A simple usage example:

import 'package:yaml_edit/yaml_edit.dart';

void main() {
  final yamlEditor = YamlEditor('{YAML: YAML}');
  yamlEditor.update(['YAML'], "YAML Ain't Markup Language");
  // Expected output:
  // {YAML: YAML Ain't Markup Language}

Example: Converting JSON to YAML (block formatted)

void main() {
  final jsonString = r'''
  "key": "value",
  "list": [
    "last entry in the list"
  "map": {
    "multiline": "this is a fairly long string with\nline breaks..."
  final jsonValue = json.decode(jsonString);

  // Convert jsonValue to YAML
  final yamlEditor = YamlEditor('');
  yamlEditor.update([], jsonValue);


Testing is done in two strategies: Unit testing (/test/editor_test.dart) and Golden testing (/test/golden_test.dart). More information on Golden testing and the input/output format can be found at /test/testdata/

These tests are automatically run with pub run test.


  1. Users are not allowed to define tags in the modifications.
  2. Map keys will always be added in the flow style.