Slackbot
06/27/2022, 9:28 AMVampire
06/27/2022, 9:33 AMTapchicoma
06/27/2022, 9:34 AMVampire
06/27/2022, 9:34 AMVampire
06/27/2022, 10:16 AMinline fun <reified T> cachedProvider(crossinline block: () -> T): Provider<T> =
objects
.property<T>()
.value(provider { block() })
.apply {
disallowChanges()
finalizeValueOnRead()
}Tapchicoma
06/27/2022, 10:17 AMfinalizeValueOnRead()?Vampire
06/27/2022, 10:22 AMVampire
06/27/2022, 10:23 AMProvider does not have that method, thus the detour over an unmodifiable (disallowChanges()) Property