mean static method

num mean(
  1. List<num> values
)

Calculates the mean of a list of values.

Implementation

static num mean(List<num> values) {
  if (values.isEmpty) throw ArgumentError('The list cannot be empty.');
  num sum = 0;
  for (final value in values) {
    sum += value;
  }
  return sum / values.length;
}