https://kotlinlang.org logo
#compose
Title
# compose
s

Shakil Karim

05/30/2021, 10:59 AM
Hi, is there any example of how can i use Navigation Compose 2.4.0-alpha01 new method currentBackStackEntryAsFlow(), I noticed @cb Tivi project is using this approach do we still need OnDestinationChangedListener or we can achieve the same with currentBackStackEntryAsFlow()?
@Ian Lake Can you please help me with this?
i

Ian Lake

06/01/2021, 9:22 PM
That isn't a new method, that's been there since the first 1.0.0-alpha01. We use that in the docs: https://developer.android.com/jetpack/compose/navigation#bottom-nav
It really depends on if you are trying to get change events (that's where collecting on the flow or a
OnDestinationChangedListener
would be helpful) or if you're trying to use the current state as something driving other composables
10 Views