From d45eea833938912baeea01f57ac287f0d30b8688 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Tue, 13 Jun 2023 17:19:18 +0200 Subject: [PATCH] neon_news: simplify feedsUnreadCountSum --- packages/neon/neon_news/lib/sort/folders.dart | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/neon/neon_news/lib/sort/folders.dart b/packages/neon/neon_news/lib/sort/folders.dart index 2797a079..b769ad8b 100644 --- a/packages/neon/neon_news/lib/sort/folders.dart +++ b/packages/neon/neon_news/lib/sort/folders.dart @@ -21,9 +21,4 @@ class FolderFeedsWrapper { final List feeds; } -int feedsUnreadCountSum(final List feeds) => [ - 0, // Fixes error when no feeds are in the folder - ...feeds.map((final f) => f.unreadCount!), - ].reduce( - (final a, final b) => a + b, - ); +int feedsUnreadCountSum(final List feeds) => feeds.fold(0, (final a, final b) => a + b.unreadCount!);