https://kotlinlang.org logo
l

Lucas Reis

11/01/2021, 2:35 PM
Hello! I read on the navigation compose docs that Navigation caches ViewModels while the screen is on the back stack (picture attached). But if I want to not save the state of ViewModels for a particular screen on the back stack, what should I do? I already tried changing saveState or restoreState to false. Anyone knows how to do this behavior? I want that when I navigate from the HomeScreen to a specific screen, in this case I don't want to save the HomeState, the screen can be recreated (viewmodels init called, etc) in this case. I didn't find this specific behavior on the docs.