toMap<K, V> method

Map<K, V> toMap<K, V>(
  1. MapEntry<K, V> test(
    1. int index,
    2. T e
    )
)

Implementation

Map<K, V> toMap<K, V>(MapEntry<K, V> Function(int index, T e) test) {
  final Map<K, V> map = {};
  for (var i = 0; i < length; i++) {
    final item = elementAt(i);
    final entry = test(i, item);
    map[entry.key] = entry.value;
  }
  return map;
}