---
title: "asDoubleState"
description: "Converts a `State<Double>` (as in, a [State] of boxed `Double`s) into a primitive-backed
[Double]. The state will be automatically unboxed to the required primitive type. The returned
state is read-only. The returned state will mirror the values of the base state and apply updates
in the same way as the receiver defines.

On the JVM, this conversion does not avoid the autoboxing that [Double] attempts to escape, but
instead is intended to allow interoperability between components that use either representation
of a state of type `Double`."
type: "function"
---

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


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
public fun State<Double>.asDoubleState(): DoubleState
```


Converts a `State<Double>` (as in, a `State` of boxed `Double`s) into a primitive-backed
`Double`. The state will be automatically unboxed to the required primitive type. The returned
state is read-only. The returned state will mirror the values of the base state and apply updates
in the same way as the receiver defines.

On the JVM, this conversion does not avoid the autoboxing that `Double` attempts to escape, but
instead is intended to allow interoperability between components that use either representation
of a state of type `Double`.



