PagingSource (Paging 3)
Also called: Paging 3, RemoteMediator
The Paging 3 class that loads one page of data for a key and tells the library the keys of the previous and next pages.
Definition
A Pager turns a PagingSource into a Flow of PagingData that the UI consumes while scrolling. After the data changes, the source is invalidated and a new one loads around the user's position, chosen by getRefreshKey. For offline-first lists, Room provides the PagingSource and a RemoteMediator fills the database from the network.
In practice
An orders PagingSource loads 30 orders per page using the cursor the API returned with the previous page.
Learn it in context
Lessons that use this term.