flatten static method
Turns one parsed tree of maps, lists and scalars into flat property
keys and values, by the rules listed on the class. It accepts the
result of jsonDecode as well as a YAML document.
YamlPropertySourceLoader.flatten({
'app': {'hosts': ['a', 'b'], 'tags': []},
}); // {app.hosts[0]: a, app.hosts[1]: b, app.tags: ''}
Implementation
static Map<String, Object> flatten(Object document) {
final result = <String, Object>{};
if (document is Map) {
_flatten(result, _stringKeys(document), null);
} else {
result['document'] = document;
}
return result;
}