ViewModelStoreProvider.ProviderMarkerKey
-
Cmn
object ViewModelStoreProvider.ProviderMarkerKey
A special marker key that can be used with acquireToken to manage the lifecycle of the shared state associated with a particular parentKey.
When multiple instances of ViewModelStoreProvider are created with the same parentStore and parentKey, they share a single internal state. By calling acquireToken(ProviderMarkerKey) on any of these instances, you increment a reference count on this shared state. The shared state will not be fully cleared (and thus, no child ViewModelStore instances within it will be cleared) until all tokens acquired with ProviderMarkerKey have been released via ReferenceToken.close.
This is useful in advanced scenarios where different parts of an application might create ViewModelStoreProvider instances with the same key but have different lifecycle requirements.