FLUTTER ECOSYSTEM

gmpassos/yaml_writer

YAML दस्तावेज़ लिखने के लिए एक पुस्तकालय।

yaml_writer प्रोजेक्ट कवर
Stars
16
Forks
14
अंतिम पुश (UTC)
15 फ़र॰ 2025
प्रोजेक्ट स्थिति
सक्रिय
Graciliano Monteiro Passos GitHub avatar
GITHUB User

Graciliano Monteiro Passos ↗

भाषाएँDartShell

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 5 आइटम
  • lintsडेवलपमेंट^5.1.1
  • testडेवलपमेंट^1.25.15
  • dependency_validatorडेवलपमेंट^5.0.2
  • coverageडेवलपमेंट^1.11.1
  • yamlडेवलपमेंट^3.1.3

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

yaml_writer

pub package Null Safety Codecov Dart CI GitHub Tag New Commits Last Commits Pull Requests Code size License

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

Usage

A simple usage example:

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);
}

OUTPUT:

name: "Joe"
ids: 
  - 10
  - 20
  - 30
desc: |-
    This is
    a multiline
    text
enabled: true

YAML Strings

The writer will try to encode strings using the best format depending on the text, avoiding to escape " and using | for multiline texts.

Encoding Objects

You can use YAMLWriter.toEncodable to convert an Object to an encodable version, similar to what is done by dart:convert JsonEncoder.

If YAMLWriter.toEncodable is not set, it will try to call toJson().

Features and bugs

Please file feature requests and bugs at the issue tracker.

Author

Graciliano M. Passos: gmpassos@GitHub.

Liplum: liplum@GitHub

License

Dart free & open-source license.