mean function

num mean(
  1. List<num> list
)

Returns the mean (average) of a list of numbers.

Example:

print(mean([1, 2, 3, 4, 5])); // prints: 3.0

Implementation

num mean(List<num> list) {
  return list.reduce((a, b) => a + b) / list.length;
}