I want to instantiate a ViewModel with scope of a Composable function.
How can I do this?
I don't want to use navigation-compose
to take advantage of its BackStackEntry
as ViewModelStoreOwner.
I want to instantiate a ViewModel with scope of a Composable function.
How can I do this?
I don't want to use navigation-compose
to take advantage of its BackStackEntry
as ViewModelStoreOwner.
Copyright © 2021 Jogjafile Inc.
I faced this issue recently, the only I could solve it by instantiating it manually using remember, not that perfect but it solved my use case for now.
To do the same, you can do something like: