Skip to content

Commit 0b7a11c

Browse files
authored
Merge pull request #131 from icapps/feature/fix-list-sum
fixed sum
2 parents bfcd3af + cc5539c commit 0b7a11c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
## [2.2.4] - 2025-10-15
3+
### Updated
4+
- Fixed issue where sum would not work for an empty list of double values
5+
26
## [2.2.3] - 2024-05-21
37
### Updated
48
- Added MouseRegion for TouchFeedback for non-mobile

lib/src/extension/iterable_extensions.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extension IterableExtension<T> on Iterable<T> {
1414

1515
/// Sums the result of [valueProvider] for each item
1616
E sum<E extends num>(E Function(T) valueProducer) {
17-
num value = 0;
17+
num value = (E == double ? 0.0 : 0) as E;
1818
forEach((e) => value = (value + valueProducer(e)) as E);
1919
return value as E;
2020
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: icapps architecture components for flutter projects. Contains commo
33
homepage: https://github.com/icapps/flutter-icapps-architecture
44
repository: https://github.com/icapps/flutter-icapps-architecture
55
issue_tracker: https://github.com/icapps/flutter-icapps-architecture/issues
6-
version: 2.2.3
6+
version: 2.2.4
77

88
environment:
99
sdk: '>=3.0.0 <4.0.0'

0 commit comments

Comments
 (0)