associateBy<K> method

Map<K, E> associateBy<K>(
  1. K keySelector(
    1. E element
    )
)

Returns a Map containing the elements from the given collection indexed by the key returned from keySelector function applied to each element.

Implementation

Map<K, E> associateBy<K>(K Function(E element) keySelector) =>
    Map.fromIterables(map(keySelector), this);