averageBy<T extends num> method
Null safety
- T selector(
- int index,
- E
Returns an average of all values produced by selector
function or double.nan
if there are no elements.
For example:
[jon, amy, joe].averageBy((_, student) => student.age) // => average age
Implementation
double averageBy<T extends num>(T Function(int index, E) selector) =>
mapIndexed(selector).average();