loadYaml function
Loads a single document from a YAML string.
If the string contains more than one document, this throws a YamlException. In future releases, this will become an ArgumentError.
The return value is mostly normal Dart objects. However, since YAML mappings support some key types that the default Dart map implementation doesn't (NaN, lists, and maps), all maps in the returned document are YamlMaps. These have a few small behavioral differences from the default Map implementation; for details, see the YamlMap class.
If sourceUrl
is passed, it's used as the URL from which the YAML
originated for error reporting.
If recover
is true, will attempt to recover from parse errors and may
return invalid or synthetic nodes. If errorListener
is also supplied, its
onError method will be called for each error recovered from. It is not valid
to provide errorListener
if recover
is false.
Implementation
dynamic loadYaml(String yaml,
{Uri? sourceUrl, bool recover = false, ErrorListener? errorListener}) =>
loadYamlNode(yaml,
sourceUrl: sourceUrl,
recover: recover,
errorListener: errorListener)
.value;