averageBy method

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

Returns the average of the list by applying f to each element. Returns 0 if the list is empty.

Implementation

double averageBy(num Function(T) f) => isEmpty ? 0 : sumBy(f) / length;