sumBy method
Returns the sum of selector applied to each element.
Example:
[1, 2, 3].sumBy((n) => n * 10); // 60
Implementation
int sumBy(int Function(E element) selector) {
int total = 0;
for (final E element in this) {
total += selector(element);
}
return total;
}