---
title: "getAppWidgetState"
description: "Retrieve the state of an app widget.

The state definition must be the one used for that particular app widget."
type: "function"
---

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


<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


```kotlin
public suspend fun <T> getAppWidgetState(
    context: Context,
    definition: GlanceStateDefinition<T>,
    glanceId: GlanceId,
): T
```


Retrieve the state of an app widget.

The state definition must be the one used for that particular app widget.



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


```kotlin
public suspend fun <T> GlanceAppWidget.getAppWidgetState(
    @Suppress("ContextFirst") context: Context,
    glanceId: GlanceId,
): T
```


Get the state of an App Widget.



