asComparableEntry property

Entry<K, V> asComparableEntry

MapEntry is not Comparable. If you need it to be comparable, you can use this getter to turn it into an Entry. Using Entry makes testing easier. For example:

MapEntry mapEntry = map.entries.first;

// Does NOT work.
expect(mapEntry, MapEntry("a", 1));

// Works!
expect(mapEntry.asComparableEntry, Entry("a", 1));

Note another alternative is to use containsPair matcher in the map:

// See [`containsPair` Matcher](https://pub.dev/documentation/matcher/latest/matcher/containsPair.html)
expect(map, containsPair("a", 1));

Implementation

Entry<K, V> get asComparableEntry => Entry.from<K, V>(this);