toMap<K> method

Map<K, T> toMap<K>(
  1. K findKey(
    1. T
    )
)

Implementation

Map<K, T> toMap<K>(K Function(T) findKey) {
  final Map<K, T> map = <K, T>{
    for (T element in this) findKey(element): element
  };
  return map;
}