uniqueValues<K, V> function

List<MapEntry<K, V>> uniqueValues<K, V>(
  1. Iterable<MapEntry<K, V>> entries
)

Implementation

List<MapEntry<K, V>> uniqueValues<K, V>(Iterable<MapEntry<K, V>> entries) {
  final uniqueValues = <V>{};
  final unique = <MapEntry<K, V>>[];

  for (var entry in entries) {
    if (!uniqueValues.contains(entry.value)) {
      uniqueValues.add(entry.value);
      unique.add(MapEntry(entry.key, entry.value));
    }
  }

  return unique;
}