Pager

class Pager<Key : Any, Value : Any>(    scope: CoroutineScope,     source: PagingDataSource<Key, Value>,     initialKey: Key,     config: PagingConfig = PagingConfig())

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

Each PagingData represents the current paging state and data. Pager will fetch relevant data based on PagingViewEvent received via subscribeToViewEvents

Constructors

Link copied to clipboard
fun <Key : Any, Value : Any> Pager(    scope: CoroutineScope,     source: PagingDataSource<Key, Value>,     initialKey: Key,     config: PagingConfig = PagingConfig())

Functions

Link copied to clipboard
suspend fun subscribeToViewEvents(eventFlow: MutableSharedFlow<PagingViewEvent>)

Collect events from the view to triggers page loads. Will suspend until eventFlow is terminated by sending PagingViewEvent.Terminate. This can be done by calling PagingEventEmitter.stop

Properties

Link copied to clipboard
val dataFlow: Flow<PagingData<Value>>

Hot Flow of PagingData, exposing the current state & data. A new item will be emitted whenever the PagingData.LoadState or PagingData.list is updated