sum static method

num sum(
  1. Iterable<num> values
)

Returns the sum of values.

Implementation

static num sum(Iterable<num> values) {
  var total = 0.0;
  for (final v in values) {
    total += v;
  }
  return total == total.toInt() ? total.toInt() : total;
}