Compose-Navigation: Remove previous composable from stack before navigating

In Jetpack Compose 1.0.0 to navigate and remove the previous Composable from the back stack You can use:

navController.navigate(Screens.Login.name) {
    popUpTo(Screens.Splash.name) {
        inclusive = true
    }
}

The above code will navigate from the Splash screen to Login and will pop everything up, including the Splash screen.

Navigate to a composable – docs

Leave a Comment