How to update single item using Paging 3 library

I am trying to find a way to update single item in recycler view using PagingAdapter from Paging 3 library. I have found only one way with PagingAdapter.refresh() method. But this method force to load all list from network. Does anybody know how to implement it without loading all pages from network?


Currently, the only way to update the backing dataset is to invalidate and reload the list. This is generally an acceptably cheap option for layered sources that use a cached layer (either in db such as room or in memory), although there is ongoing work to support more granular updates (see https://issuetracker.google.com/160232968).

In terms of layered source for now, you'll need to move your network calls into a RemoteMediator which you can register in Pager's constructor, and cache your network fetches into either a DB like with Room (which can generate a PagingSource implementation for you), or write an in-memory one yourself.

The codelab and DAC docs are a great resource for this, and have code samples to guide you!


Example :

fun markItemAsRead(position: Int) {
        snapshot()[position].read = true
        notifyItemChanged(position)
    }

source : https://jermainedilao.medium.com/android-paging-3-library-how-to-update-an-item-in-the-list-52f00d9c99b2