Closed right7ctrl closed 3 years ago
It was my bad :( solved like below
Future<void> getNextPage() async {
if (imagePage != null && !imagePage.isLast) {
imagePage = await imagePage.nextPage();
print('NEXT ITEMS: ${imagePage.items.length}');
imagePage.items?.sort((a, b) => b.creationDate.compareTo(a.creationDate));
print('CURRENT ITEMS: ${images.length}');
images.addAll(imagePage.items);
print('TOTAL ITEMS: ${images.length}');
notifyListeners();
}
}
When i call nextpage function first it gives me 30more images which i have been declared on take parameter. But when i call nextPage more than once, it returns take option * 2 items every time
To be more clear When i declared the MediaPage variable like this
final MediaPage mediaPage = await album.listMedia(newest: true, take: 30, skip: 0); // returns 30 items as usual
When i call sth like this
mediaPage.nextPage(); // returns 30 more items
And just wanted to call one more pagemediaPage.nextPage(); // returns 60 more items (30 * 2)
one more pagemediaPage.nextPage(); // returns 120 more items (60 * 2)
And the output
flutter: NEXT ITEMS: 30 flutter: CURRENT ITEMS: 30 flutter: TOTAL ITEMS: 60 flutter: NEXT ITEMS: 50 // i have total 110 images, if i have more it would be 120. flutter: CURRENT ITEMS: 60 flutter: TOTAL ITEMS: 110