stateful

actual fun <T : Any> StateHolder.stateful(initialValue: T): Stateful<T>

Creates a Stateful

Return

Stateful wrapping initialValue

Parameters

initialValue

initial value that will be wrapped by Stateful

expect fun <T : Any> StateHolder.stateful(initialValue: T): Stateful<T>

Returns Stateful of type T

This function can be used with by syntax

var stateful : String by stateful("Example")

To update param created by stateful simply write new value to it. This will lead to changes on platform side. Note that write operation to a field is not synchronized and synchronization is on user side.

var stateful : String by stateful("Example")

fun update() {
stateful = "Other example"
}

Receiver

StateHolder

Return

Stateful of type T

Parameters

initialValue

initial value of type T

actual fun <T : Any> StateHolder.stateful(initialValue: T): Stateful<T>

Creates Stateful with provided initial value and callback set to one defined in StateHolder's Binder object.

Return

Stateful wrapping initialValue

Parameters

initialValue

initial value that will be wrapped by Stateful

actual fun <T : Any> StateHolder.stateful(initialValue: T): Stateful<T>