average method

double? average()

Returns the average value (arithmetic mean) of all elements.

Example:

[2.0, 4.0, 6.0, 8.0].average(); // 5.0

Implementation

double? average() => averageBy((n) => n);