# NestedPrefetchScope

# NestedPrefetchScope

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/layout/LazyLayoutPrefetchState.kt+class:androidx.compose.foundation.lazy.layout.NestedPrefetchScope)  
Added in[1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)
Common/AllAndroid/JVM
  - Cmn  

  ```
  @ExperimentalFoundationApi
  sealed interface NestedPrefetchScope
  ```

*** ** * ** ***

A scope which allows nested prefetches to be requested for the precomposition of a LazyLayout.

## Summary

|                                 ### Public functions                                 |
|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [schedulePrecomposition](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrecomposition(kotlin.Int))`(index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Requests a child index to be precomposed as part of the prefetch of a parent LazyLayout.                                                                                                                                                                                                   | Cmn |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [schedulePrecompositionAndPremeasure](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrecompositionAndPremeasure(kotlin.Int,androidx.compose.ui.unit.Constraints))`(index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, constraints: `[Constraints](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)`)` Requests a child index to be precomposed and premeasured as part of the prefetch of a parent LazyLayout. | Cmn |
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | ~~[schedulePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrefetch(kotlin.Int))~~`(index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.**Please use schedulePrecomposition(index) instead                                                                                                                                                                                                                   | Cmn |
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | ~~[schedulePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrefetch(kotlin.Int,androidx.compose.ui.unit.Constraints))~~`(index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, constraints: `[Constraints](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)`)` **This function is deprecated.**Please use schedulePremeasure(index, constraints) instead                                                  | Cmn |

|                               ### Public properties                                |
|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [nestedPrefetchItemCount](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#nestedPrefetchItemCount()) The projected number of nested items that should be prefetched during a Nested Prefetching of an internal LazyLayout. | Cmn |

## Public functions

### schedulePrecomposition

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

```
fun schedulePrecomposition(index: Int): Unit
```

Requests a child index to be precomposed as part of the prefetch of a parent LazyLayout.

The prefetch will only do the precomposition for the new item. If you also want to premeasure please use[schedulePrecompositionAndPremeasure](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrecompositionAndPremeasure(kotlin.Int,androidx.compose.ui.unit.Constraints)).  

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|-------------------------|
| `index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | item index to prefetch. |

### schedulePrecompositionAndPremeasure

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

```
fun schedulePrecompositionAndPremeasure(index: Int, constraints: Constraints): Unit
```

Requests a child index to be precomposed and premeasured as part of the prefetch of a parent LazyLayout. If you just want to precompose an item use[schedulePrecomposition](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrecomposition(kotlin.Int))instead.  

|                                                    Parameters                                                     |
|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| `index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                              | the index of the child to prefetch.                                                                                        |
| `constraints: `[Constraints](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints) | [Constraints](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)to use for premeasuring. |

### schedulePrefetch

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

```
open fun [schedulePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrefetch(kotlin.Int))(index: Int): Unit
```
| **This function is deprecated.**   
| Please use schedulePrecomposition(index) instead

Requests a child index to be prefetched as part of the prefetch of a parent LazyLayout.

The prefetch will only do the precomposition for the new item. If you also want to premeasure please use a second overload accepting a[Constraints](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)param.  

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|-------------------------|
| `index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | item index to prefetch. |

### schedulePrefetch

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

```
open fun [schedulePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope#schedulePrefetch(kotlin.Int,androidx.compose.ui.unit.Constraints))(index: Int, constraints: Constraints): Unit
```
| **This function is deprecated.**   
| Please use schedulePremeasure(index, constraints) instead

Requests a child index to be prefetched as part of the prefetch of a parent LazyLayout.  

|                                                    Parameters                                                     |
|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| `index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                              | the index of the child to prefetch.                                                                                        |
| `constraints: `[Constraints](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints) | [Constraints](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)to use for premeasuring. |

## Public properties

### nestedPrefetchItemCount

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

```
open val nestedPrefetchItemCount: Int
```

The projected number of nested items that should be prefetched during a Nested Prefetching of an internal LazyLayout. This will return -1 if a projection isn't available yet. The parent Lazy Layout will use information about an item's content type and number of visible items to calculate the necessary number of items that a child layout will need to prefetch.