remember
abstract fun <ResultT> remember(key: String, resultType: KType, vararg inputs: Any?, calculation: () -> ResultT): ResultT(source)
Rather than calling this directly, prefer the inline extension function which will capture resultType for you.
Remember the value calculated by the calculation lambda. The calculation will be run the first time, and on any subsequent render pass where the inputs have changed.
Parameters
key
used to distinguish between calculations of the same type
inputs
any inputs to the calculation. The calculation will only rerun if any of these inputs changes, so make sure you use the exact list of inputs for the calculation here.
calculation
a lambda that performs the calculation based on the inputs.
Throws
if key has already been used in the current render
call for a lambda of the same shape