uniqueKeys<K, V> function

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

Implementation

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

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

  return unique;
}