average method
Returns the average of all the values in this iterable, as defined by
value
.
Returns null if this
is empty.
Example:
['a', 'aa', 'aaa'].average((s) => s.length); // 2
[].average(); // null
Implementation
num? average(num Function(E) value) {
if (this.isEmpty) return null;
return this.sum(value) / this.length;
}