sum property

int sum

Calculates the sum of all elements in the list. Returns the sum as a number. Example usage:

[1, 2, 3].sum => 6

Implementation

int get sum => isEmpty ? 0 : reduce((value, element) => value + element);