---
title: "currentState"
description: "Retrieves the current customizable store for view specific state data as defined by
[GlanceStateDefinition] in the surface implementation."
type: "composable"
---

<div class='type'>Composable Function</div>


<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable public inline fun <reified T> currentState(): T
```


Retrieves the current customizable store for view specific state data as defined by
`GlanceStateDefinition` in the surface implementation.

#### Returns

| | |
| --- | --- |
|  | the current store of the provided type `T` |




<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
public inline fun <reified T> currentState(key: Preferences.Key<T>): T?
```


Retrieves the current `Preferences` value of the provided `Preferences.Key` from the current
state when `Preferences` store is used as `GlanceStateDefinition` in the surface implementation.

#### Parameters

| | |
| --- | --- |
| key | the `Preferences.Key` to retrieve its value |


#### Returns

| | |
| --- | --- |
|  | the stored value or null if not available. |





