Flutter - Loading paged JSON data into the ListView

Published: 24 March 2018
on channel: Brandon Donnelson
24,609
275

In this episode, I cover building a infinite list view which loads paged data using a offset and limit. I mock a call that retrieves json and show how to update the list view.

I cover these points in the video:
Fetch paged data using an offset & limit
Display loading until the data is returned
Decode JSON into a list of objects
Scrolling will fetch more paged data
Scrolling back will fetch cached data

Source code:
https://gist.github.com/branflake2267...

Source code fixes for Dart 2:
In this source I explicitly cast.
I change JSON.decode to new JsonCodec().decode
https://gist.github.com/branflake2267...

Something I don't cover in this episode, when the cached data grows, it could reach a size detrimental to the application. With this in mind, it could easily be remedied with logic that evicts data loaded in to the cache.