sum method

double sum(
  1. double sumFun(
    1. E
    ), {
  2. double initValue = 0,
})

Implementation

double sum(double Function(E) sumFun, {double initValue = 0}) {
  double sum = initValue;
  for (var item in this) {
    sum += sumFun(item);
  }
  return sum;
}