Pager

class Pager<Key : Any, Value : Any>
kotlin.Any
   ↳ androidx.paging.Pager

Primary entry point into Paging; constructor for a reactive stream of PagingData.

Each PagingData represents a snapshot of the backing paginated data. Updates to the backing dataset should be represented by a new instance of PagingData.

PagingSource.invalidate and calls to AsyncPagingDataDiffer.refresh or PagingDataAdapter.refresh will notify Pager that the backing dataset has been updated and a new PagingData / PagingSource pair will be generated to represent an updated snapshot.

PagingData can be transformed to alter data as it loads, and presented in a RecyclerView via AsyncPagingDataDiffer or PagingDataAdapter.

LiveData support is available as an extension property provided by the androidx.paging:paging-runtime artifact.

RxJava support is available as extension properties provided by the androidx.paging:paging-rxjava2 artifact.

Summary

Public constructors
<init>(config: PagingConfig, initialKey: Key? = null, remoteMediator: RemoteMediator<Key, Value>? = null, pagingSourceFactory: () -> PagingSource<Key, Value>)

Primary entry point into Paging; constructor for a reactive stream of PagingData.

Properties
Flow<PagingData<Value>>

A cold Flow of PagingData, which emits new instances of PagingData once they become invalidated by PagingSource.invalidate or calls to AsyncPagingDataDiffer.refresh or PagingDataAdapter.refresh.

Extension properties
From androidx.paging.rxjava2
Flowable<PagingData<Value>>

A Flowable of PagingData, which mirrors the stream provided by Pager.flow, but exposes it as a Flowable.

Observable<PagingData<Value>>

An Observable of PagingData, which mirrors the stream provided by Pager.flow, but exposes it as an Observable.

From androidx.paging.rxjava3
Flowable<PagingData<Value>>

A Flowable of PagingData, which mirrors the stream provided by Pager.flow, but exposes it as a Flowable.

Observable<PagingData<Value>>

An Observable of PagingData, which mirrors the stream provided by Pager.flow, but exposes it as an Observable.

From androidx.paging
LiveData<PagingData<Value>>

A LiveData of PagingData, which mirrors the stream provided by Pager.flow, but exposes it as a LiveData.

Public constructors

<init>

Pager(
    config: PagingConfig,
    initialKey: Key? = null,
    remoteMediator: RemoteMediator<Key, Value>? = null,
    pagingSourceFactory: () -> PagingSource<Key, Value>)

Primary entry point into Paging; constructor for a reactive stream of PagingData.

Each PagingData represents a snapshot of the backing paginated data. Updates to the backing dataset should be represented by a new instance of PagingData.

PagingSource.invalidate and calls to AsyncPagingDataDiffer.refresh or PagingDataAdapter.refresh will notify Pager that the backing dataset has been updated and a new PagingData / PagingSource pair will be generated to represent an updated snapshot.

PagingData can be transformed to alter data as it loads, and presented in a RecyclerView via AsyncPagingDataDiffer or PagingDataAdapter.

LiveData support is available as an extension property provided by the androidx.paging:paging-runtime artifact.

RxJava support is available as extension properties provided by the androidx.paging:paging-rxjava2 artifact.

Properties

flow

val flow: Flow<PagingData<Value>>

A cold Flow of PagingData, which emits new instances of PagingData once they become invalidated by PagingSource.invalidate or calls to AsyncPagingDataDiffer.refresh or PagingDataAdapter.refresh.