Function

setValue

Permits property delegation of vars using by for MutableDoubleState.

DelegatedStateSample

@Suppress("ReplaceWithOperatorAssignment")
@Sampled
@Composable
fun DelegatedStateSample() {
    var count by remember { mutableStateOf(0) }

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

private class Subscription {
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: