sumBy method
Calculates the sum of all elements in the iterable by mapping them to numeric values.
Example:
var list = ['a', 'ab'];
var result = list.sumBy((s) => s.length); // 3
Implementation
num sumBy(num Function(T) selector) =>
isEmpty ? 0 : map(selector).reduce((value, element) => value + element);