asIntState
Function
Common
public fun State<Int>.asIntState(): IntState
Converts a State<Int>
(as in, a State
of boxed Int
s) into a primitive-backed IntState
.
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 IntState
attempts to escape, but
instead is intended to allow interoperability between components that use either representation
of a state of type Int
.