Frank van der Laan
07/04/2022, 10:20 AMpopUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
as a result, my tab's ViewModels is not cleared when switching tabs. That's good. But let's say the user now logs out and I want to clear this ViewModel after all. How do I do so? Popping all screens from the backstack will clear all their ViewModels, but this screen is not in the backstack anymore./**
* Clears any saved state associated with [route] that was previously saved
* via [popBackStack] when using a `saveState` value of `true`.
*
* @param route The route of the destination previously used with [popBackStack] with a
* `saveState` value of `true`
*
* @return true if the saved state of the stack associated with [route] was cleared.
*/
@MainThread
public fun clearBackStack(
route: String
): Boolean = clearBackStack(createRoute(route).hashCode())
Ian Lake
07/04/2022, 2:54 PMFrank van der Laan
07/04/2022, 5:57 PM