sumBy<R extends num> method
R
sumBy<R extends num>(
- R selector(
- T
Returns the sum of all values produced by selector
function applied to each element in the collection.
Implementation
R sumBy<R extends num>(R Function(T) selector) {
var sum = R == double ? 0.0 : 0;
for (final element in iter) {
sum += selector(element);
}
return sum as R;
}