Minimum reproducible code:
void main() {
var map = SplayTreeMap<String, int>((k1, k2) => k1.length - k2.length);
map['foo'] = 2;
map['bar'] = 1;
map.forEach((k, v) => print('[$k]: $v'));
}
The output is:
[foo]: 1
Not only the value is swapped but also the bar key seems to be lost. However, the following code returns true.
print(map.containsKey('bar')); // true
So, how is this possible?