Skip to content
0:00 / 0:00

#flutter#listview#json

Flutter - Loading paged JSON data into the ListView

Brandon Donnelson

7.5K subscribers • 9 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Brandon Donnelson
  • May be out of date. The tools, versions or practices it shows have likely moved on.

Intermediate. Assumes working knowledge.

24K views8 years ago2 recommendations

Mobile developmentHTTP, REST and GraphQL

Brandon Donnelson demonstrates how to build an infinite scrolling ListView in Flutter that loads and caches paged JSON data.

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: gist.github.com/branflake2267/dd7251ace7997622d585b4d0769c28… Source code fixes for Dart 2: - In this source I explicitly cast. - I change JSON.decode to new JsonCodec().decode gist.github.com/branflake2267/31aa8a6ce9b2f4f3956c433e3acfb6… 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.

Why it's here

2 people recommend this

What people say. Recommended as a practical guide to implementing infinite scrolling and pagination in Flutter.

u/branflake2267in r/FlutterDev • Recommends

Loading paged JSON data into the ListView

u/spiderfarmerin r/FlutterDev • Recommends

On “Infinite Scrolling, HTTP json with an refresh indicator”

You probably want something like this: [video In this tutorial: * 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 Github: https://gist.github.com/branflake2267/31aa8a6ce9b2f4f3956c433e3acfb60d