# CompositionLocalMap

Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/CompositionLocalMap.kt+class:androidx.compose.runtime.CompositionLocalMap) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.5.0) Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  sealed interface CompositionLocalMap
  ```

*** ** * ** ***

A read-only, immutable snapshot of the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal` that are set at a specific position in the composition hierarchy.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap#Empty()` An empty `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap` instance which contains no keys or values. | Cmn |

| ### Public functions |
|---|---|---|
| `operator T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap#get(androidx.compose.runtime.CompositionLocal)(key: https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal<T>)` Returns the value of the provided `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap#get(androidx.compose.runtime.CompositionLocal)` at the position in the composition hierarchy represented by this `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap` instance. | Cmn |

## Public companion properties

### Empty

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

```
val Empty: CompositionLocalMap
```

An empty `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap` instance which contains no keys or values.

## Public functions

### get

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

```
operator fun <T : Any?> get(key: CompositionLocal<T>): T
```

Returns the value of the provided `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap#get(androidx.compose.runtime.CompositionLocal)` at the position in the composition hierarchy represented by this `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap` instance. If the provided `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalMap#get(androidx.compose.runtime.CompositionLocal)` is not set at this point in the hierarchy, its default value will be used.

For `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#compositionLocalOf(androidx.compose.runtime.SnapshotMutationPolicy,kotlin.Function0)`, this function will return the latest value of the CompositionLocal, which might change over time across the same instance of the CompositionLocalMap. Reads done in this way are not tracked in the snapshot system.

For `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#staticCompositionLocalOf(kotlin.Function0)`, this function returns the value at the time of creation of the CompositionLocalMap. When a static CompositionLocal is reassigned, the entire composition hierarchy is recomposed and a new CompositionLocalMap is created with the updated value of the static CompositionLocal.