associateByTransform<K, V> method
Returns a Map containing the elements from the given collection indexed by the key
returned from keySelector
function applied to each element. The element can be transformed with valueTransform
.
If any two elements would have the same key returned by keySelector
the last one gets added to the map.
The returned map preserves the entry iteration order of the original collection.
Implementation
KtMap<K, V> associateByTransform<K, V>(
K Function(T) keySelector, V Function(T) valueTransform) {
final map =
associateByTo(linkedMapFrom<K, V>(), keySelector, valueTransform);
// TODO ping dort-lang/sdk team to check type bug
// When in single line: type 'DartLinkedHashMap<int, String>' is not a subtype of type 'Null'
return map;
}