lastBy<S, T> function
Associates the elements in values
by the value returned by key
.
Returns a map from keys computed by key
to the last value for which key
returns that key.
Implementation
Map<T, S> lastBy<S, T>(Iterable<S> values, T Function(S) key) =>
{for (var element in values) key(element): element};