diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cb04e5..74bb7ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## [2.2.4] - 2025-10-15 +### Updated +- Fixed issue where sum would not work for an empty list of double values + ## [2.2.3] - 2024-05-21 ### Updated - Added MouseRegion for TouchFeedback for non-mobile diff --git a/lib/src/extension/iterable_extensions.dart b/lib/src/extension/iterable_extensions.dart index 84af123..073fffb 100644 --- a/lib/src/extension/iterable_extensions.dart +++ b/lib/src/extension/iterable_extensions.dart @@ -14,7 +14,7 @@ extension IterableExtension on Iterable { /// Sums the result of [valueProvider] for each item E sum(E Function(T) valueProducer) { - num value = 0; + num value = (E == double ? 0.0 : 0) as E; forEach((e) => value = (value + valueProducer(e)) as E); return value as E; } diff --git a/pubspec.yaml b/pubspec.yaml index 80692e9..7e66fdd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: icapps architecture components for flutter projects. Contains commo homepage: https://github.com/icapps/flutter-icapps-architecture repository: https://github.com/icapps/flutter-icapps-architecture issue_tracker: https://github.com/icapps/flutter-icapps-architecture/issues -version: 2.2.3 +version: 2.2.4 environment: sdk: '>=3.0.0 <4.0.0'