decodeAgentYaml function
Parses a YAML document yaml into a plain Map<String, dynamic>.
Throws FormatException when the document's root is not a mapping.
Implementation
Map<String, dynamic> decodeAgentYaml(String yaml) {
final root = deepPlainYaml(loadYaml(yaml));
if (root is! Map<String, dynamic>) {
throw const FormatException('expected a YAML mapping at the document root');
}
return root;
}