I would like to have something like Android Compose’s remember(key) { init } in plain JVM Kotlin. So some sort of Lazy delegate but on every access it calls a key function and if its return value changed the value is recalculated. Is there a simple standard library functionality for achieving this or do I need to create a custom class?
>Solution :
No, there is no built-in way to do this. You must do something custom, although you may find it useful to look into how Lazy works to replicate it yourself.