Primary entry point into Paging; constructor for a reactive stream of
PagingSource.invalidate and calls to
PagingDataAdapter.refresh will notify
Pager that the backing dataset has been updated and a new
PagingSource pair will be generated to represent an updated snapshot.
PagingData can be transformed to alter data as it loads, and presented in a
LiveData support is available as an extension property provided by the
RxJava support is available as extension properties provided by the
To consume this stream as a LiveData or in Rx, you may use the extensions available in the paging-runtime or paging-rxjava* artifacts.
NOTE: Instances of
PagingData emitted by this
Flow are not re-usable and cannot be submitted multiple times. This is especially relevant for transforms such as
Flow.combine, which would replay the latest value downstream. To ensure you get a new instance of
PagingData for each downstream observer, you should use the
cachedIn operator which multicasts the
Flow in a way that returns a new instance of
PagingData with cached data pre-loaded.
public final <Key extends Object, Value extends Object> Pager(
@NonNull PagingConfig config,
@Nullable Key initialKey,
@Nullable RemoteMediator<@NonNull Key, @NonNull Value> remoteMediator,
@NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory