In my unit test, I need to test order of elements as that :
test("Check map order", () {
LinkedHashMap<String, String> actualMap = LinkedHashMap();
actualMap["0"] = "firstValue";
actualMap["1"] = "secondValue";
LinkedHashMap<String, String> expectedMap = LinkedHashMap();
expectedMap["1"] = "secondValue";
expectedMap["0"] = "firstValue";
print("actual: $actualMap");
print("expected: $expectedMap");
expect(actualMap, isNot(expectedMap));
});
This test fails, event if order is respected:
actual: {0: firstValue, 1: secondValue}
expected: {1: secondValue, 0: firstValue}
package:test_api expect
test/services/game/negotiation/NegotiationGameService_test.dart 33:7 main.<fn>.<fn>
Expected: not {'1': 'secondValue', '0': 'firstValue'}
Actual: {'0': 'firstValue', '1': 'secondValue'}