Skip to content
pubscout

yaml_writer

2.1.0, released 2 years ago by an unverified publisher

A library to write YAML documents supporting Object encoding and dart:convert Converter.

WASM-ready
$ flutter pub add yaml_writer
Source repository

What it does

Serializes Dart maps, lists, and objects into properly formatted YAML documents. It handles multiline text, string formatting, and object encoding with options similar to dart:convert's JsonEncoder.

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

Use it when

  • You need to serialize Dart objects or maps into YAML text strings.
  • You want to convert Dart data structures into YAML using a 'dart:convert' Converter.

Skip it when

  • You need to parse or read YAML documents instead of writing them.

Strengths

  • Supports Object encoding and 'dart:convert' 'Converter'.
  • Intelligently formats strings, avoiding unnecessary quotes and handling multiline texts.
  • Zero dependencies.

Weaknesses

  • Only writes YAML; does not provide reading or parsing capabilities.
  • Limited documentation beyond basic examples.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:yaml_writer/yaml_writer.dart';

void main() {
  final yamlWriter = YamlWriter();

  final yamlDoc = yamlWriter.write({
    'name': 'Joe',
    'ids': [10, 20, 30],
    'desc': 'This is\na multiline\ntext',
    'enabled': true,
  });

  print(yamlDoc);
}

Alternatives

Packages that do the same job and could replace yaml_writer.

  • dart_helper_utils

    Dart extensions and helpers for maps, strings, collections, dates, async, and intl formatting.

  • enough_convert

    Support for character encodings and codecs missing from dart:convert.

  • charset_converter

    Platform‑native charset encoder/decoder with no Dart dependencies

  • pem

    PEM encoding and decoding of textual keys and certificates following RFC 7468.

Works with

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