Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot access 'backQueue': it is private in 'NavController'

val queue = navController.backQueue backQueue becomes private in androidx.navigation:navigation-runtime:2.6.0-alpha07@aar

Is there any substitute?

like image 961
gaohomway Avatar asked Jan 29 '26 03:01

gaohomway


1 Answers

It seems like you can temporarily access currentBackStack in NavController.

/**
 * Retrieve the current back stack.
 *
 * @return The current back stack.
 * @hide
 */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public val currentBackStack: StateFlow<List<NavBackStackEntry>> =
    _currentBackStack.asStateFlow()

Please make sure you read this first: https://issuetracker.google.com/issues/217465473#comment6 to fully understand the consequences as this API, just like backQueue, might not be stable.

like image 144
scana Avatar answered Jan 31 '26 07:01

scana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!