retainSaveable
fun <T : Any> retainSaveable(vararg inputs: Any?, saver: Saver<T, out Any> = autoSaver(), key: String? = null, calculation: () -> T): T(source)
Retains the value produced by calculation and opportunistically saves it with saver.
Parameters
inputs
A set of inputs that reset the retained value when any of them change.
saver
Defines how the value is saved and restored.
key
An optional explicit identity for the retained and saved value.
calculation
A factory that creates the value when neither retained nor saved state exists.
fun <T> retainSaveable(vararg inputs: Any?, stateSaver: Saver<T, out Any>, key: String? = null, calculation: () -> MutableState<T>): MutableState<T>(source)
Retains a MutableState produced by calculation and opportunistically saves its value with stateSaver.