sumBy method

double sumBy(
  1. num? selector(
    1. E element
    )
)

Returns the sum of all values produced by selector function applied to each element in the collection.

null values are not counted.

Implementation

double sumBy(num? Function(E element) selector) {
  var sum = 0.0;
  for (var current in this) {
    sum += selector(current) ?? 0;
  }
  return sum;
}