Paging data from database and network in Flutter

Viewed 122

I'm pretty new to Flutter development, coming from an Android background. I want to implement the following pattern like it is commenly used with the Paging 3 jetpack library:

UI <-------> Repo --- Out of data ---> Network
               ^                          |
               |                          |
               ---------- Save ------------ 

I also want to support paging in both directions. Anything I have seen so far on pub.dev is only paging in one direction. Do I have to implement this pattern for myself or is there already a library for this?

1 Answers

Since the data is from a database via network, you could use dio to do network requests and dio_http_cache to cache the data. With forceRefresh option enabled, user would see the cached data when they don't have internet access and see fresh data when they have internet access.

This is the closest at this time to what you need.

Related