marcglasberg / fast_immutable_collections

Dart Package: Immutable lists, sets, maps, and multimaps, which are as fast as their native mutable counterparts. Extension methods and comparators for native Dart collections.
BSD 2-Clause "Simplified" License
213 stars 30 forks source link

ListMap: forEach does not respect key order #34

Closed vHanda closed 2 years ago

vHanda commented 2 years ago

Hello.

test('Key Order', () {
  var map = ListMap.of({
    'b': 1,
    'a': 2,
  });

  var str1 = "";
  map.forEach((key, value) => str1 += key);

  var str2 = "";
  for (var e in map.entries) {
    str2 += e.key;
  }
  expect(str1, str2);
});

forEach gives ab (incorrect) for gives ba (correct)

marcglasberg commented 2 years ago

Thank you for catching this! Fixed in version [7.1.3].