From ce8b1eb3cef674ef79013a31c17832aa77d01c7c Mon Sep 17 00:00:00 2001 From: Piotr Tobolski Date: Sun, 18 Nov 2018 11:24:13 +0100 Subject: [PATCH] Fix calculating endIndex of the catalog slice Start index shouldn't be added to the maximum index retrieved from pages --- shared/lib/src/bloc_complex/catalog/catalog_slice.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shared/lib/src/bloc_complex/catalog/catalog_slice.dart b/shared/lib/src/bloc_complex/catalog/catalog_slice.dart index 09f68c7..7438aeb 100644 --- a/shared/lib/src/bloc_complex/catalog/catalog_slice.dart +++ b/shared/lib/src/bloc_complex/catalog/catalog_slice.dart @@ -29,8 +29,7 @@ class CatalogSlice { hasNext = true; /// The index of the last product of this slice. - int get endIndex => - startIndex + _pages.map((page) => page.endIndex).fold(-1, max); + int get endIndex => _pages.map((page) => page.endIndex).fold(-1, max); /// Returns the product at [index], or `null` if data isn't loaded yet. Product elementAt(int index) {