averageBy method

double averageBy(
  1. num selector(
    1. T
    )
)

Calculates the average of a property of each element.

Implementation

double averageBy(num Function(T) selector) {
  if (isEmpty) return 0;
  return sumBy(selector) / length;
}