popUpToDestination

fun NavOptionsBuilder.popUpToDestination(destination: DestinationId<*, *>, popUpToBuilder: PopUpToBuilder.() -> Unit = {})

Pop up to a given destination before navigating. This pops all non-matching destination routes from the back stack until the destination with a matching route is found.