# DynamicDataKey

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataKey.kt+class:androidx.wear.protolayout.expression.DynamicDataKey) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
public abstract class DynamicDataKey<T extends DynamicBuilders.DynamicType>
```

<br />

Known direct subclasses [AppDataKey](https://developer.android.com/reference/androidx/wear/protolayout/expression/AppDataKey), [PlatformDataKey](https://developer.android.com/reference/androidx/wear/protolayout/expression/PlatformDataKey)

|---|---|
| `https://developer.android.com/reference/androidx/wear/protolayout/expression/AppDataKey` | Represent a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey` that references app/tile pushed state data. |
| `https://developer.android.com/reference/androidx/wear/protolayout/expression/PlatformDataKey` | Represent a `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey` that references real-time data from the platform. |

*** ** * ** ***

Represent a key that references a dynamic value source, such as state pushed by app/tile or real-time data from the platform.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicType>` | The data type of the dynamic values that this key is bound to. |

## Summary

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#getKey()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#getNamespace()()` |
| `int` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#toString()()` |

| ### Extension functions |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicBool>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPairUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicBool> receiver, boolean value )` Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Boolean)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPairUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(android.graphics.Color)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicColor> receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html value )` Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(android.graphics.Color)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 300) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPairUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(java.time.Duration)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration> receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Duration.html value )` Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(java.time.Duration)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPairUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat> receiver, float value )` Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Float)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInstant>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 300) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPairUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(java.time.Instant)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInstant> receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html value )` Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(java.time.Instant)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPairUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Int)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32> receiver, int value )` Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Int)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicString>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPairUtil.https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.String)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataKey<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicString> receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value )` Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.String)`. |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getKey

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public final @NonNull String getKey()
```

### getNamespace

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public final @NonNull String getNamespace()
```

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```

## Extension functions

### DynamicDataPairUtil.mapTo

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataPair.kt+function:mapTo)

```
@RequiresSchemaVersion(major = 1, minor = 200)
public final @NonNull DynamicDataPair<@NonNull DynamicBuilders.DynamicBool> DynamicDataPairUtil.mapTo(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicBool> receiver,
    boolean value
)
```

Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Boolean)`.

### DynamicDataPairUtil.mapTo

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataPair.kt+function:mapTo)

```
@RequiresSchemaVersion(major = 1, minor = 200)
public final @NonNull DynamicDataPair<@NonNull DynamicBuilders.DynamicColor> DynamicDataPairUtil.mapTo(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicColor> receiver,
    @NonNull Color value
)
```

Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(android.graphics.Color)`.

### DynamicDataPairUtil.mapTo

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataPair.kt+function:mapTo)

```
@RequiresSchemaVersion(major = 1, minor = 300)
public final @NonNull DynamicDataPair<@NonNull DynamicBuilders.DynamicDuration> DynamicDataPairUtil.mapTo(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicDuration> receiver,
    @NonNull Duration value
)
```

Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(java.time.Duration)`.

### DynamicDataPairUtil.mapTo

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataPair.kt+function:mapTo)

```
@RequiresSchemaVersion(major = 1, minor = 200)
public final @NonNull DynamicDataPair<@NonNull DynamicBuilders.DynamicFloat> DynamicDataPairUtil.mapTo(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicFloat> receiver,
    float value
)
```

Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Float)`.

### DynamicDataPairUtil.mapTo

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataPair.kt+function:mapTo)

```
@RequiresSchemaVersion(major = 1, minor = 300)
public final @NonNull DynamicDataPair<@NonNull DynamicBuilders.DynamicInstant> DynamicDataPairUtil.mapTo(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInstant> receiver,
    @NonNull Instant value
)
```

Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(java.time.Instant)`.

### DynamicDataPairUtil.mapTo

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataPair.kt+function:mapTo)

```
@RequiresSchemaVersion(major = 1, minor = 200)
public final @NonNull DynamicDataPair<@NonNull DynamicBuilders.DynamicInt32> DynamicDataPairUtil.mapTo(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInt32> receiver,
    int value
)
```

Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.Int)`.

### DynamicDataPairUtil.mapTo

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicDataPair.kt+function:mapTo)

```
@RequiresSchemaVersion(major = 1, minor = 200)
public final @NonNull DynamicDataPair<@NonNull DynamicBuilders.DynamicString> DynamicDataPairUtil.mapTo(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicString> receiver,
    @NonNull String value
)
```

Creates a tuple of type `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicDataPair` from this and `https://developer.android.com/reference/androidx/wear/protolayout/expression/package-summary#(androidx.wear.protolayout.expression.DynamicDataKey).mapTo(kotlin.String)`.