LazyListPrefetchScope
Interface
Common
@ExperimentalFoundationApi
interface LazyListPrefetchScope
Scope for callbacks in LazyListPrefetchStrategy
which allows prefetches to be requested.
Functions
fun schedulePrefetch(
index: Int,
onPrefetchFinished: (LazyListPrefetchResultScope.() -> Unit)? = null,
): LazyLayoutPrefetchState.PrefetchHandle
Schedules a prefetch for the given index. Requests are executed in the order they're
requested. If a requested prefetch is no longer necessary (for example, due to changing
scroll direction), the request should be canceled via
LazyLayoutPrefetchState.PrefetchHandle.cancel
.
See PrefetchScheduler
.
Parameters
index | the index of the child to prefetch |
onPrefetchFinished | A callback that will be invoked when the prefetching of this item is completed. This means precomposition and premeasuring. If the request is canceled before either phases can complete, this callback won't be called. The item index and the main axis size in pixels of the prefetched item is available as a parameter of this callback. See LazyListPrefetchResultScope for additional information about the prefetched item. |