average property Null safety
The arithmetic mean of the elements of a non-empty iterable.
The arithmetic mean is the sum of the elements divided by the number of elements.
The iterable must not be empty.
Implementation
double get average {
var result = 0.0;
var count = 0;
for (var value in this) {
count += 1;
result += (value - result) / count;
}
if (count == 0) throw StateError('No elements');
return result;
}