The use of a HashMap here https://github.com/dart-lang/yaml/blob/master/lib/src/equality.dart#L13 ensures that when the elements of a map are added here https://github.com/dart-lang/yaml/blob/master/lib/src/loader.dart#L156 the order is nondeterministic. This shows itself in tools that read then write yaml - the output is needlessly reorganized. The default behaviour should keep the input order (change HashMap to LinkedHashMap) Sorting would be a nice option, but keeping the original order would