MutableState

Known direct subclasses
MutableDoubleState

A value holder where reads to the doubleValue property during the execution of a Composable function cause the current RecomposeScope to subscribe to changes of that value.

MutableFloatState

A value holder where reads to the floatValue property during the execution of a Composable function cause the current RecomposeScope to subscribe to changes of that value.

MutableIntState

A value holder where reads to the intValue property during the execution of a Composable function cause the current RecomposeScope to subscribe to changes of that value.

MutableLongState

A value holder where reads to the longValue property during the execution of a Composable function cause the current RecomposeScope to subscribe to changes of that value.

ProduceStateScope

Receiver scope for use with produceState.

SnapshotMutableState

A mutable value holder where reads to the value property during the execution of a Composable function, the current RecomposeScope will be subscribed to changes of that value.


A mutable value holder where reads to the value property during the execution of a Composable function, the current RecomposeScope will be subscribed to changes of that value. When the value property is written to and changed, a recomposition of any subscribed RecomposeScopes will be scheduled. If value is written to with the same value, no recompositions will be scheduled.

Summary

Public functions

operator T
Cmn
operator (T) -> Unit
Cmn

Public properties

T
Cmn

Extension functions

inline operator Unit
<T : Any?> MutableState<T>.setValue(
    thisObj: Any?,
    property: KProperty<*>,
    value: T
)

Permits property delegation of vars using by for MutableState.

Cmn

Public functions

component1

operator fun component1(): T

component2

operator fun component2(): (T) -> Unit

Public properties

value

var value: T

Extension functions

inline operator fun <T : Any?> MutableState<T>.setValue(
    thisObj: Any?,
    property: KProperty<*>,
    value: T
): Unit

Permits property delegation of vars using by for MutableState.

import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember

var count by remember { mutableStateOf(0) }

Text(text = "You clicked $count times")
Button(onClick = { count = count + 1 }) { Text("Click me") }