Viewing version 3.1.0. Open the latest package page.

yaml

3.1.0

A parser for YAML, a human-friendly data serialization standard

Download archive

Readme

A parser for YAML.

Pub Package Build Status

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

3.1.0

  • loadYaml and related functions now accept a recover flag instructing the parser to attempt to recover from parse errors and may return invalid or synthetic nodes. When recovering, an ErrorListener can also be supplied to listen for errors that are recovered from.
  • Drop dependency on package:charcode.

3.0.0

  • Stable null safety release.

3.0.0-nullsafety.0

  • Updated to support 2.12.0 and null safety.
  • Allow YamlNodes to be wrapped with an optional style parameter.
  • BREAKING The sourceUrl named argument is statically typed as Uri instead of allowing String or Uri.

2.2.1

  • Update min Dart SDK to 2.4.0.
  • Fixed span for null nodes in block lists.

2.2.0

  • POSSIBLY BREAKING CHANGE: Make YamlMap preserve parsed key order. This is breaking because some programs may rely on the HashMap sort order.

2.1.16

  • Fixed deprecated API usage in README.
  • Fixed lints that affect package score.

2.1.15

  • Set max SDK version to <3.0.0, and adjust other dependencies.

2.1.14

  • Remove use of deprecated features.
  • Updated SDK version to 2.0.0-dev.17.0

2.1.13

  • Stop using comment-based generic syntax.

2.1.12

  • Properly refuse mappings with duplicate keys.

2.1.11

  • Fix an infinite loop when parsing some invalid documents.

2.1.10

  • Support string_scanner 1.0.0.

2.1.9

  • Fix all strong-mode warnings.

2.1.8

  • Remove the dependency on path, since we don't actually import it.

2.1.7

  • Fix more strong mode warnings.

2.1.6

  • Fix two analysis issues with DDC's strong mode.

2.1.5

  • Fix a bug with 2.1.4 where source span information was being discarded for scalar values.

2.1.4

  • Substantially improve performance.

2.1.3

  • Add a hint that a colon might be missing when a mapping value is found in the wrong context.

2.1.2

  • Fix a crashing bug when parsing block scalars.

2.1.1

  • Properly scope SourceSpans for scalar values surrounded by whitespace.

2.1.0

  • Rewrite the parser for a 10x speed improvement.

  • Support anchors and aliases (&foo and *foo).

  • Support explicit tags (e.g. !!str). Note that user-defined tags are still not fully supported.

  • %YAML and %TAG directives are now parsed, although again user-defined tags are not fully supported.

  • YamlScalar, YamlList, and YamlMap now expose the styles in which they were written (for example plain vs folded, block vs flow).

  • A yamlWarningCallback field is exposed. This field can be used to customize how YAML warnings are displayed.

2.0.1+1

  • Fix an import in a test.

  • Widen the version constraint on the collection package.

2.0.1

  • Fix a few lingering references to the old Span class in documentation and tests.

2.0.0

  • Switch from source_maps' Span class to source_span's SourceSpan class.

  • For consistency with source_span and string_scanner, all sourceName parameters have been renamed to sourceUrl. They now accept Urls as well as Strings.

1.1.1

  • Fix broken type arguments that caused breakage on dart2js.

  • Fix an analyzer warning in yaml_node_wrapper.dart.

1.1.0

  • Add new publicly-accessible constructors for YamlNode subclasses. These constructors make it possible to use the same API to access non-YAML data as YAML data.

  • Make YamlException inherit from source_map's SpanFormatException. This improves the error formatting and allows callers access to source range information.

1.0.0+1

  • Fix a variable name typo.

1.0.0

  • Backwards incompatibility: The data structures returned by loadYaml and loadYamlStream are now immutable.

  • Backwards incompatibility: The interface of the YamlMap class has changed substantially in numerous ways. External users may no longer construct their own instances.

  • Maps and lists returned by loadYaml and loadYamlStream now contain information about their source locations.

  • A new loadYamlNode function returns the source location of top-level scalars as well.

0.10.0

  • Improve error messages when a file fails to parse.

0.9.0+2

  • Ensure that maps are order-independent when used as map keys.

0.9.0+1

  • The YamlMap class is deprecated. In a future version, maps returned by loadYaml and loadYamlStream will be Dart HashMaps with a custom equality operation.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'yaml:3.1.0'
pubspec.yaml
name: yaml
version: 3.1.0

description: A parser for YAML, a human-friendly data serialization standard
homepage: https://github.com/dart-lang/yaml

environment:
  sdk: '>=2.12.0-0 <3.0.0'

dependencies:
  collection: ^1.15.0
  source_span: ^1.8.0
  string_scanner: ^1.1.0

dev_dependencies:
  path: ^1.8.0
  pedantic: ^1.10.0
  test: ^1.16.0-nullsafety

Version history

VersionPublishedArchiveSHA-256
0.3.4Cached · Upstream SHA-256 matchedDownload4b440fb1…f4bfb2
0.3.5+1Cached · Upstream SHA-256 matchedDownload6fdd99e9…4a9c26
0.3.7+6Cached · Upstream SHA-256 matchedDownload8ff3249e…d3a1a5
0.4.0Cached · Upstream SHA-256 matchedDownload32c65f2f…c24bb9
0.4.1Cached · Upstream SHA-256 matchedDownload3e1fa2e0…31b81b
0.4.2Cached · Upstream SHA-256 matchedDownloadf6b64a94…37da1c
0.4.3+1Cached · Upstream SHA-256 matchedDownload7b1ffd28…d92f88
0.4.4+4Cached · Upstream SHA-256 matchedDownload75c244dd…662f4e
0.4.5+1Cached · Upstream SHA-256 matchedDownloadb555b775…f8e962
0.4.7+1Cached · Upstream SHA-256 matchedDownload13c4f557…77320f
0.5.0+1Cached · Upstream SHA-256 matchedDownload6ac0e974…8a7fff
0.5.1Cached · Upstream SHA-256 matchedDownload07bedef6…1dbad3
0.5.4Cached · Upstream SHA-256 matchedDownload757249ce…ba25dc
0.5.5Cached · Upstream SHA-256 matchedDownload300dd60a…8b423d
0.5.6Cached · Upstream SHA-256 matchedDownload75b6bbd6…ed6f3d
0.5.7Cached · Upstream SHA-256 matchedDownloade3cc8dfa…445f05
0.5.9Cached · Upstream SHA-256 matchedDownload3ed862f8…5f9a8c
0.5.11+1Cached · Upstream SHA-256 matchedDownload75ce5436…3fcbe6
0.5.12Cached · Upstream SHA-256 matchedDownload73c8e102…5d38bd
0.5.13Cached · Upstream SHA-256 matchedDownload04527cc7…f62add
0.5.14+1Cached · Upstream SHA-256 matchedDownloade0ae2593…0201d9
0.5.14+3Cached · Upstream SHA-256 matchedDownloade0e3884f…811dfa
0.5.15Cached · Upstream SHA-256 matchedDownload0009ea94…afda65
0.5.16Cached · Upstream SHA-256 matchedDownloadfe62aa69…ca5f6f
0.5.17Cached · Upstream SHA-256 matchedDownloadc62f40aa…7d7268
0.5.20Cached · Upstream SHA-256 matchedDownloadb6bb65a2…131eca
0.6.1Cached · Upstream SHA-256 matchedDownloadf036a048…2b5dd1
0.6.2Cached · Upstream SHA-256 matchedDownload0ad3080d…536ddc
0.6.3+1Cached · Upstream SHA-256 matchedDownloadb514f062…0c4cab
0.6.5Cached · Upstream SHA-256 matchedDownload348e763b…d85aea
0.6.6Cached · Upstream SHA-256 matchedDownload694c8cfc…4652f5
0.6.8Cached · Upstream SHA-256 matchedDownload002b80e0…29043e
0.6.9Cached · Upstream SHA-256 matchedDownload90440d11…d0743f
0.6.9+2Cached · Upstream SHA-256 matchedDownload712bce73…f49f0b
0.6.11Cached · Upstream SHA-256 matchedDownload868d55ee…300ba5
0.6.12Cached · Upstream SHA-256 matchedDownload576319d5…de9c87
0.6.13Cached · Upstream SHA-256 matchedDownload4278886f…9e5d37
0.6.14Cached · Upstream SHA-256 matchedDownloadb07a560d…944cb8
0.6.15+2Cached · Upstream SHA-256 matchedDownload704e2e2e…9dae4c
0.6.15+3Cached · Upstream SHA-256 matchedDownload340f6c12…b70fd6
0.6.17Cached · Upstream SHA-256 matchedDownloaded0db96b…b5bfbf
0.6.17+2Cached · Upstream SHA-256 matchedDownloadc1eb816a…e0b528
0.6.19Cached · Upstream SHA-256 matchedDownloadc8bcce7f…4080bf
0.6.20+1Cached · Upstream SHA-256 matchedDownload632d66f3…d6adc8
0.6.21+3Cached · Upstream SHA-256 matchedDownloadcf4e6e7e…7011ee
0.7.0Cached · Upstream SHA-256 matchedDownload21e35184…20e87e
0.7.1Cached · Upstream SHA-256 matchedDownloade85b3767…d5e277
0.7.2Cached · Upstream SHA-256 matchedDownloadb998b415…bb1ab3
0.7.2+1Cached · Upstream SHA-256 matchedDownloadd5b3918c…a72d0f
0.7.3+1Cached · Upstream SHA-256 matchedDownload951861ae…239f37
0.7.4Cached · Upstream SHA-256 matchedDownload92cbd61c…a69826
0.7.5Cached · Upstream SHA-256 matchedDownload10834a68…cea731
0.7.6Cached · Upstream SHA-256 matchedDownload8d3858fb…42c1e6
0.7.6+4Cached · Upstream SHA-256 matchedDownload634b4cb9…0e817b
0.8.0Cached · Upstream SHA-256 matchedDownload6f0ab6f2…82c257
0.8.1Cached · Upstream SHA-256 matchedDownload671406cb…8a175d
0.8.2Cached · Upstream SHA-256 matchedDownload4688f650…dee332
0.8.3Cached · Upstream SHA-256 matchedDownload01c00d4b…b9f34c
0.8.4Cached · Upstream SHA-256 matchedDownload0052a3b2…f97c0a
0.8.5Cached · Upstream SHA-256 matchedDownload94268f31…b1e972
0.8.6Cached · Upstream SHA-256 matchedDownload8d7457fe…50b4fe
0.8.7Cached · Upstream SHA-256 matchedDownload56ac0de1…d867c6
0.8.8Cached · Upstream SHA-256 matchedDownload6a563d0b…b0aa87
0.8.9Cached · Upstream SHA-256 matchedDownloada4966d36…236c91
0.8.10Cached · Upstream SHA-256 matchedDownload1f4d27dd…73c71e
0.8.10+3Cached · Upstream SHA-256 matchedDownload9f4b07af…84408b
0.8.10+4Cached · Upstream SHA-256 matchedDownload50c35781…ba74f0
0.9.0Cached · Upstream SHA-256 matchedDownload7cc9aa56…f594a7
0.9.0+2Cached · Upstream SHA-256 matchedDownload497e78c1…fdae3d
0.10.0Cached · Upstream SHA-256 matchedDownload083e2450…cc34fc
1.0.0+2Cached · Upstream SHA-256 matchedDownload0e556940…5a2c19
1.1.0Cached · Upstream SHA-256 matchedDownload593b8819…5f1f7e
1.1.1Cached · Upstream SHA-256 matchedDownload5b6b2d78…ddcde6
2.0.0Cached · Upstream SHA-256 matchedDownloadbb580c0b…4e801a
2.0.1+1Cached · Upstream SHA-256 matchedDownload999a4814…1aa53f
2.1.0Cached · Upstream SHA-256 matchedDownload1ae8892a…d02636
2.1.1Cached · Upstream SHA-256 matchedDownload6f5d1ab5…10d979
2.1.2Cached · Upstream SHA-256 matchedDownload26cff8ea…99194e
2.1.3Cached · Upstream SHA-256 matchedDownload06f84753…86e96d
2.1.4Cached · Upstream SHA-256 matchedDownload3b9e03f0…f7af13
2.1.5Cached · Upstream SHA-256 matchedDownload9141567a…d0be05
2.1.6Cached · Upstream SHA-256 matchedDownload7fec73d1…608701
2.1.7Cached · Upstream SHA-256 matchedDownload969a52a1…a6db4a
2.1.8Cached · Upstream SHA-256 matchedDownload648b5466…ca210a
2.1.9Cached · Upstream SHA-256 matchedDownloadde0b35b1…f9ba04
2.1.10Cached · Upstream SHA-256 matchedDownload865cf567…12a8a7
2.1.11Cached · Upstream SHA-256 matchedDownloadd0fba518…77b408
2.1.12Cached · Upstream SHA-256 matchedDownloadcae64a13…5928b4
2.1.13Cached · Upstream SHA-256 matchedDownload1bf24dda…f7709c
2.1.14Cached · Upstream SHA-256 matchedDownloadcf84b4d2…4ee5d5
2.1.15Cached · Upstream SHA-256 matchedDownloadbc8cded9…78d264
2.1.16Cached · Upstream SHA-256 matchedDownloadefe4f1f3…530cdb
2.2.0Cached · Upstream SHA-256 matchedDownload1195a16c…cf6745
2.2.1Cached · Upstream SHA-256 matchedDownload5ec3d7ff…4b9274
3.0.0-nullsafety.0Cached · Upstream SHA-256 matchedDownloadd3d56bd9…fbfefb
3.0.0Cached · Upstream SHA-256 matchedDownload252eb4c4…581e41
3.1.0Cached · Upstream SHA-256 matchedDownload3cee79b1…337ace
3.1.1Cached · Upstream SHA-256 matchedDownload23812a9b…db2370
3.1.2Cached · Upstream SHA-256 matchedDownload75769501…5989d5
3.1.3Cached · Upstream SHA-256 matchedDownloadb9da305a…0d76ce
3.1.4Cached · Upstream SHA-256 matchedDownloadf67cdd8e…068aea

Dependencies

collection "^1.15.0"

source_span "^1.8.0"

string_scanner "^1.1.0"