Skip to content
pubscout

yaml_edit

2.2.4, released 9 months ago by tools.dart.dev

YAML manipulation library preserving comments and whitespace

WASM-ready
$ flutter pub add yaml_edit
Source repository

What it does

Provides a YamlEditor class to parse, modify, and serialize YAML while keeping comments and formatting intact. It supports updates, inserts, deletions, and conversion from JSON.

AI-written summary of version 2.2.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to edit YAML files programmatically while keeping comments
  • You want to convert JSON to YAML with preserved structure
  • You require fine-grained control over YAML nodes

Skip it when

  • You only need simple YAML parsing without comment preservation
  • You need a code generation tool for YAML schemas

Strengths

  • Preserves comments and whitespace
  • Supports complex updates via path-based API
  • Handles JSON-to-YAML conversion

Weaknesses

  • No support for custom tags
  • Map keys always added in flow style
  • Limited to YAML manipulation only

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4
import 'package:yaml_edit/yaml_edit.dart';
final editor = YamlEditor('{YAML: YAML}');
editor.update(['YAML'], "YAML Ain't Markup Language");
print(editor);

Alternatives

Packages that do the same job and could replace yaml_edit.

Works with

Packages commonly used together with yaml_edit: ones it builds on, ones built on it, and its own family.