---
title: "GlanceStateDefinition"
description: "Configuration definition for [GlanceState]. This defines where the data is stored and how the
underlying data store is created. Use a unique [GlanceStateDefinition] to get a [GlanceState],
once defined, the data should be updated using the state directly, this definition should not
change."
type: "interface"
---

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


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

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



```kotlin
public interface GlanceStateDefinition<T>
```


Configuration definition for `GlanceState`. This defines where the data is stored and how the
underlying data store is created. Use a unique `GlanceStateDefinition` to get a `GlanceState`,
once defined, the data should be updated using the state directly, this definition should not
change.


## Functions

```kotlin
public fun getLocation(context: Context, fileKey: String): File
```


This file indicates the location of the persisted data.

#### Parameters

| | |
| --- | --- |
| context | The context used to create the file directory |
| fileKey | The unique string key used to name and identify the data file corresponding to a remote UI. Each remote UI has a unique UI key, used to key the data for that UI. |



```kotlin
public suspend fun getDataStore(context: Context, fileKey: String): DataStore<T>
```


Creates the underlying data store.

#### Parameters

| | |
| --- | --- |
| context | The context used to create locate the file directory |
| fileKey | The unique string key used to name and identify the data file corresponding to a remote UI. Each remote UI has a unique UI key, used to key the data for that UI. |




