average static method

double average(
  1. Iterable<Object?> values
)

Arithmetic mean of values treated as bytes.

Implementation

static double average(Iterable<Object?> values) {
  var count = 0;
  var total = 0.0;
  for (final value in values) {
    total += _toDouble(value);
    count++;
  }
  if (count == 0) {
    throw ArgumentError('Cannot compute average of empty collection');
  }
  return total / count;
}