Is Navigator a good use-case for provided as an Am...
# compose
s
Is Navigator a good use-case for provided as an Ambient?
i
FWIW, for Navigation Compose, we made a conscious decision not to implement an ambient as it ends up making it a lot harder to reason about changes in the state and it makes it harder to build decoupled, reusable composables that aren't completely dependent on your navigation system. We talk about this specifically in terms of testability in the docs: https://developer.android.com/jetpack/compose/navigation#testing
💯 3
you can certainly ignore that advice and use ambients for this, sure, but keep in mind what indirect coupling you're actually creating and the issues that may arise from this pattern
s
Yup Agree, it become a lot harder for testability later on with Ambients
1