remember View Model
Composable function that remembers a ViewModel instance in a Composable tree using Kodein DI container. It returns ViewModelLazy, a property delegate that lazily accesses the ViewModel instance.
Return
ViewModelLazy
Parameters
the type of the ViewModel to be remembered.
an optional tag to filter the bindings in the DI container. If changed during composition, a new instance will be created.
Throws
if no DI container is attached to the Composable tree.
Creates a ViewModel instance using Kodein dependency injection and remembers it for recomposition. The ViewModel will be scoped to the current scope defined by the ViewModelStoreOwner.
Return
ViewModelLazy instance representing the remembered ViewModel.
Parameters
The type of argument to be passed to the ViewModel constructor.
The type of ViewModel to be created.
The optional tag to be used for resolving ViewModel instance from DI container. If changed during composition, a new instance will be created
The argument value to be passed to the ViewModel constructor. If changed during composition, a new instance will be created.
Throws
if ViewModelStoreOwner is missing for LocalViewModelStoreOwner.