rememberFlatLightState

inline fun rememberFlatLightState(id: String = remember { generateRandomLightId("flat") }, key: String? = null, crossinline init: FlatLightState.() -> Unit = {}): FlatLightState

Create and rememberSaveable a FlatLightState using Saver. init will be called when the FlatLightState is first created to configure its initial state.

This function does not automatically update the FlatLightState if key is updated. To update state properties imperatively, use LaunchedEffect:

val light = rememberFlatLightState()
LaunchedEffect(intensity) {
light.intensity = DoubleValue(intensity)
}

Parameters

key

An optional key to be used as a key for the saved value. If not provided we use the automatically generated by the Compose runtime which is unique for the every exact code location in the composition tree.

init

A function initialise this FlatLightState.