pkg/yaml: YamlMap iteration order doesn't preserve yaml document order #21328
Labels
area-pkg
Used for miscellaneous pkg/ packages not associated with specific area- teams.
closed-not-planned
Closed as we don't intend to take action on the reported issue
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @seaneagan
Here's the failing test:
import 'package:unittest/unittest.dart';
import 'package:yaml/yaml.dart';
main() {
Map map = loadYaml(yaml);
expect(map.keys.toList(), ['foo', 'bar', 'baz']);
}
var yaml = '''
foo: x
bar: y
baz: z
''';
Guessing it would just need to switch to an underlying LinkedHashMap so long as the keys are inserted in document order. I expected this to work given that it does with JSON.
The text was updated successfully, but these errors were encountered: