FlowPagedListBuilder

class FlowPagedListBuilder<K : Any, V : Any>(dataSourceFactory: DataSource.Factory<K, V>, config: PagedList.Config, var initialLoadKey: K? = null, var boundaryCallback: PagedList.BoundaryCallback<V>? = null, notifyDispatcher: CoroutineDispatcher = Dispatchers.Main, fetchDispatcher: CoroutineDispatcher = Dispatchers.IO) : AbstractFlowPagedListBuilder<K, V>

Builder for Flow<PagedList> given a DataSource.Factory and a PagedList.Config.

The required parameters are in the constructor, so you can simply construct and build, or optionally enable extra features (such as initial load key, or BoundaryCallback).

The returned Flow will already be subscribed on the fetchDispatcher, and will perform all loading on that scheduler. It will already be observed on notifyDispatcher, and will dispatch new PagedLists, as well as their updates to that scheduler.

Parameters

K

Type of input valued used to load data from the DataSource. Must be integer if you're using PositionalDataSource.

V

Item type being presented.

Constructors

Link copied to clipboard
constructor(dataSourceFactory: DataSource.Factory<K, V>, config: PagedList.Config, initialLoadKey: K? = null, boundaryCallback: PagedList.BoundaryCallback<V>? = null, notifyDispatcher: CoroutineDispatcher = Dispatchers.Main, fetchDispatcher: CoroutineDispatcher = Dispatchers.IO)

Properties

Link copied to clipboard

Typically used to load additional data from network when paging from local storage.

Link copied to clipboard
open override var initialLoadKey: K?

First loading key passed to the first PagedList/DataSource.

Functions

Link copied to clipboard
open override fun buildFlow(): Flow<PagedList<V>>

Constructs a Flow<PagedList>.