average static method

double average(
  1. Iterable<num> values
)

Average of values. Returns 0 for an empty collection.

Implementation

static double average(Iterable<num> values) {
  final List<num> list = values.toList();
  if (list.isEmpty) return 0;
  return sum(list) / list.length;
}