sum method
Returns the sum of all the values in this iterable, as defined by
addend
.
Returns 0 if this
is empty.
Example:
['a', 'aa', 'aaa'].sum((s) => s.length); // 6
Implementation
num sum(num Function(E) addend) => this.isEmpty
? 0
: this.fold(0, (prev, element) => prev + addend(element));