lifecycleRetainedStateRegistry
expect fun lifecycleRetainedStateRegistry(key: String = LifecycleRetainedStateRegistry.KEY): RetainedStateRegistry(source)
Returns a RetainedStateRegistry that is lifecycle-aware, allowing state to be retained across recompositions.
The underlying mechanism typically involves a platform-specific lifecycle-scoped object, such as a ViewModel
.
Return
A RetainedStateRegistry instance associated with the given key and the current lifecycle.
Parameters
key
A unique key to identify this registry. This key is used to scope the retained state. Using different keys allows for multiple independent registries within the same lifecycle. Defaults to LifecycleRetainedStateRegistry.KEY.