invert method
Inverts keys and values. On duplicate values, last key wins. Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
Map<V, K> invert() {
final Map<V, K> out = <V, K>{};
for (final MapEntry<K, V> e in entries) {
out[e.value] = e.key;
}
return out;
}