transform

Functions summary

State<R>
@Composable
<R : Any?> transform(
    initialValue: R,
    dispatcher: CoroutineDispatcher,
    onUpdate: @Composable (R) -> R
)

A Composable transform that remembers the resulting State and ties the headless composition to the current CoroutineScope provided by the Compose lifecycle.

Cmn

Functions

@Composable
fun <R : Any?> transform(
    initialValue: R,
    dispatcher: CoroutineDispatcher = Dispatchers.Default,
    onUpdate: @Composable (R) -> R
): State<R>

A Composable transform that remembers the resulting State and ties the headless composition to the current CoroutineScope provided by the Compose lifecycle.

Parameters
initialValue: R

The initial value to populate the returned State before the first composition completes.

dispatcher: CoroutineDispatcher = Dispatchers.Default

The CoroutineDispatcher thread this transform should run on.

onUpdate: @Composable (R) -> R

The Composable block that computes the value of type R.

Returns
State<R>

A State containing the latest result of the transform block.