remember Image Source State
inline fun rememberImageSourceState(key: String? = null, sourceId: String = remember {
generateRandomSourceId("image")
}, crossinline init: ImageSourceState.() -> Unit = {}): ImageSourceState
Create and rememberSaveable a ImageSourceState using ImageSourceState.Saver. init will be called when the ImageSourceState is first created to configure its initial state.
This function does not automatically update the ImageSourceState if sourceId is updated. To update state properties imperatively, use LaunchedEffect:
val state = rememberImageSourceState()
LaunchedEffect(url) {
state.url = StringValue(url)
}Content copied to clipboard
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.
source Id
The optional sourceId for the source state, by default, a random source ID will be used.
init
A function initialise this ImageSourceState.