Skip to content
Videos
Video

Flutter - Loading paged JSON data into the ListView

by Brandon Donnelson youtu.be

39 min 24.8k views

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/dd7251ace7997622d585b4d0769c28d3 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/31aa8a6ce9b2f4f3956c433e3acfb60d 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.

Forum

Questions about this, or something to add?

Discuss on the forum

Report this · Wrote this? Claim it

Supported by