retain

fun <T : Any> retain(vararg inputs: Any?, key: String, calculation: () -> T): T(source)

Retains the value produced by calculation under the explicit key.

Parameters

inputs

A set of inputs that reset the retained value when any of them change.

key

The key used to identify the retained value.

calculation

A factory that creates the retained value.