pageable

fun <Key : Any, PageItem> pageable(coroutineScope: CoroutineScope, onPage: Unit.(key: Key) -> Flow<List<PageItem>?>, strategy: PageFetchStrategy<Key, PageItem, Unit>, onPageEvent: (event: PageEvent<Key>) -> Unit? = null, resultingItemsTransform: (List<PageItem>) -> List<PageItem> = { it }, initialItems: List<PageItem> = emptyList()): Pageable<Key, PageItem>

Creates a Pageable with integer-based page keys starting from 0.


fun <Key : Any, PageItem, Context> pageable(coroutineScope: CoroutineScope, context: StateFlow<Context>, onPage: Context.(key: Key) -> Flow<List<PageItem>?>, strategy: PageFetchStrategy<Key, PageItem, Context>, onPageEvent: (event: PageEvent<Key>) -> Unit? = null, resultingItemsTransform: (List<PageItem>) -> List<PageItem> = { it }, initialItems: List<PageItem> = emptyList()): Pageable<Key, PageItem>

Creates a Pageable that can react to changes in the provided context.

When the context emits a new value, any currently cached pages are invalidated and re-fetched.