commit | 0cc0d90cd15c2629bad0df48a712cde01a9bf461 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch@google.com> | Mon Nov 09 15:16:32 2020 -0800 |
committer | Nate Bosch <nbosch@google.com> | Mon Nov 09 15:16:32 2020 -0800 |
tree | 2f5466ed4bd28fc80c8776ac07efb0d1baa2a1c4 | |
parent | 11d051475259020610d6debd10331046ed845450 [diff] |
Different pattern for _span so it doesn't need to be late Instead of marking the field nullable, or late, add a constructor in the abstract class and use it from the others. It was already impossible to correctly subclass `YamlNode` from outside the library, so the addition of a private constructor should not be breaking.
A parser for YAML.
Use loadYaml
to load a single document, or loadYamlStream
to load a stream of documents. For example:
import 'package:yaml/yaml.dart'; main() { var doc = loadYaml("YAML: YAML Ain't Markup Language"); print(doc['YAML']); }
This library currently doesn't support dumping to YAML. You should use json.encode
from dart:convert
instead:
import 'dart:convert'; import 'package:yaml/yaml.dart'; main() { var doc = loadYaml("YAML: YAML Ain't Markup Language"); print(json.encode(doc)); }