Can anybody point me to some docs or source that shows the best practice for a real app that contains more than just one ViewModel? I'm trying to understand the best way to configure the app so that the state controls the page shown and each page has its own view model that is only created when the page loads. I can only find simple examples that gloss over that type of complexity.
04/13/2022, 7:39 PM
If you are using Navigation Compose, this is how it works automatically: any call to
within a screen is scoped to that screen by default. It wouldn't exist if that screen doesn't exist and when that screen is popped off the back stack, it is cleared as well