# LazyGridPrefetchScope

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/lazy/grid/LazyGridPrefetchStrategy.kt+class:androidx.compose.foundation.lazy.grid.LazyGridPrefetchScope) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0) Deprecated in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01) Common/All
- Cmn

  ```
  @ExperimentalFoundationApi
  interface LazyGridPrefetchScope
  ```

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> LazyGridPrefetchScope is deprecated alongside LazyGridPrefetchStrategy. Prefetching behavior should be configured using LazyLayoutCacheWindow.

Scope for callbacks in `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchStrategy` which allows prefetches to be requested.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState.PrefetchHandle>` | `[scheduleLinePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchScope#scheduleLinePrefetch(kotlin.Int))(lineIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** LazyGridPrefetchScope is deprecated alongside LazyGridPrefetchStrategy. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState.PrefetchHandle>` | `[scheduleLinePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchScope#scheduleLinePrefetch(kotlin.Int,kotlin.Function1))(lineIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, onPrefetchFinished: (https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchResultScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?)` **This function is deprecated.** LazyGridPrefetchScope is deprecated alongside LazyGridPrefetchStrategy. | Cmn |

## Public functions

### scheduleLinePrefetch

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0) Deprecated in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
fun [scheduleLinePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchScope#scheduleLinePrefetch(kotlin.Int))(lineIndex: Int): List<LazyLayoutPrefetchState.PrefetchHandle>
```

> [!CAUTION]
> **This function is deprecated.**   
> LazyGridPrefetchScope is deprecated alongside LazyGridPrefetchStrategy. Prefetching behavior should be configured using LazyLayoutCacheWindow.

Schedules a prefetch for the given line 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 `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState.PrefetchHandle#cancel()`.

See `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchScheduler`.

| Parameters |
|---|---|
| `lineIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | index of the row or column to prefetch |

### scheduleLinePrefetch

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0) Deprecated in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
open fun [scheduleLinePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchScope#scheduleLinePrefetch(kotlin.Int,kotlin.Function1))(lineIndex: Int, onPrefetchFinished: (LazyGridPrefetchResultScope.() -> Unit)?): List<LazyLayoutPrefetchState.PrefetchHandle>
```

> [!CAUTION]
> **This function is deprecated.**   
> LazyGridPrefetchScope is deprecated alongside LazyGridPrefetchStrategy. Prefetching behavior should be configured using LazyLayoutCacheWindow.

Schedules a prefetch for the given line 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 `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState.PrefetchHandle#cancel()`.

See `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchScheduler`.

| Parameters |
|---|---|
| `lineIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | index of the row or column to prefetch |
| `onPrefetchFinished: (https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchResultScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?` | A callback that will be invoked when the prefetching of this line is completed. This means precomposition and premeasuring. If the request is canceled before either phases can complete, or before all items in this line have been prepared, this callback won't be invoked. The lineIndex and the main axis size in pixels of the prefetched items are available as a parameter of this callback. See `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPrefetchResultScope` for information about the line prefetched. |