# Infinite Scrolling Pagination in Flutter | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567>\
**Category:** 🎓 Courses & Articles\
**Created:** [October 14, 2020, 2:11am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567 "2020-10-14T02:11:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebueno](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ebueno/32/110264_2.png) [@ebueno](https://forums.kodeco.com/u/ebueno)\
**Post date:** [October 14, 2020, 2:11am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/1 "2020-10-14T02:11:11Z")

</div>

Learn how to implement infinite scrolling pagination (also known as lazy loading) in Flutter using the Infinite Scroll Pagination package.

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/14214369-infinite-scrolling-pagination-in-flutter](https://www.raywenderlich.com/14214369-infinite-scrolling-pagination-in-flutter)

---

<div class="post-metadata">

**Author:** ![cuong1112035](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/cuong1112035/32/101506_2.png) [@cuong1112035](https://forums.kodeco.com/u/cuong1112035)\
**Post date:** [October 30, 2020, 9:28am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/2 "2020-10-30T09:28:17Z")

</div>

how to delete an item in the data list please? I mean I have a 100 items displayed, then I want to delete an item at 0 index

---

<div class="post-metadata">

**Author:** ![ebueno](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ebueno/32/110264_2.png) [@ebueno](https://forums.kodeco.com/u/ebueno)\
**Post date:** [October 30, 2020, 9:53am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/3 "2020-10-30T09:53:07Z")

</div>

Hi @cuong1112035.

You can control what items are shown by using the `itemList` property of `PagingController`.  
Here’s how your function deleting an item could look like:

```dart
final oldList = _pagingController.itemList;
final newList = oldList..removeAt(0);
_pagingController.itemList = newList;

```

By changing the `itemList` property, the UI will automatically reflect the changes.

---

<div class="post-metadata">

**Author:** ![cuong1112035](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/cuong1112035/32/101506_2.png) [@cuong1112035](https://forums.kodeco.com/u/cuong1112035)\
**Post date:** [October 30, 2020, 2:02pm UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/4 "2020-10-30T14:02:55Z")

</div>

setState(() {  
final oldList = \_pagingController.itemList;  
final newList = oldList…removeAt(0);  
\_pagingController.itemList = newList;  
});  
It works for me, many thanks

---

<div class="post-metadata">

**Author:** ![ebueno](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ebueno/32/110264_2.png) [@ebueno](https://forums.kodeco.com/u/ebueno)\
**Post date:** [November 3, 2020, 7:44am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/5 "2020-11-03T07:44:48Z")

</div>

If your widget hierarchy is big, a better alternative than `setState` would be creating a copy of the old list. Like this:

```dart
final oldList = _pagingController.itemList;
final newList = List.of(oldList);
newList.removeAt(0);
_pagingController.itemList = newList;

```

That way, the only thing rebuilt will be your paged list.

---

<div class="post-metadata">

**Author:** ![winter](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/winter/32/81494_2.png) [@winter](https://forums.kodeco.com/u/winter)\
**Post date:** [November 29, 2020, 5:03am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/6 "2020-11-29T05:03:53Z")

</div>

Thank you for the tutorial but many things for beginer level.

---

<div class="post-metadata">

**Author:** ![himeshp](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/himeshp/32/81494_2.png) [@himeshp](https://forums.kodeco.com/u/himeshp)\
**Post date:** [July 23, 2021, 4:54am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/7 "2021-07-23T04:54:13Z")

</div>

Hi, is there a way where this can work with page view builder as well?

---

<div class="post-metadata">

**Author:** ![murnikov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/murnikov/32/81494_2.png) [@murnikov](https://forums.kodeco.com/u/murnikov)\
**Post date:** [September 22, 2021, 10:01am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/8 "2021-09-22T10:01:47Z")

</div>

Great job with the tutorial!  
Any suggestions for implementing bidirectional lazy loading based on **infinite\_scroll\_pagination** , which seems to be quite a mature package?  
Struggling with a calendar application. Obvious use case - start off with today’s entries and scroll back or forward chronologically. Dataset in question currently has 16K+ entries and stretches way back into 2008 and forward into next 2-3 months.

---

<div class="post-metadata">

**Author:** ![flutterlearnerhere](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/flutterlearnerhere/32/101506_2.png) [@flutterlearnerhere](https://forums.kodeco.com/u/flutterlearnerhere)\
**Post date:** [December 16, 2021, 12:16am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/9 "2021-12-16T00:16:08Z")

</div>

In _“paged\_article\_list\_view.dart”_, inside `initState()`, when we call `_pagingController.addPageRequestListener((pageKey) {_fetchPage(pageKey);});`, what exactly is pageKey and how is it defined?

I believe it is endpoint used to identify pages - similar to firstPageKey. But how is it initialized / defined?

---

<div class="post-metadata">

**Author:** ![abhishek\_jain](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/abhishek_jain/32/110937_2.png) [@abhishek\_jain](https://forums.kodeco.com/u/abhishek_jain)\
**Post date:** [January 17, 2025, 11:28am UTC](https://forums.kodeco.com/t/infinite-scrolling-pagination-in-flutter-raywenderlich-com/122567/10 "2025-01-17T11:28:03Z")

</div>

thank you for the solution.
