Is Navigator a good use-case for provided as an Ambient?
02/06/2021, 5:26 PM
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
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
02/06/2021, 5:37 PM
Yup Agree, it become a lot harder for testability later on with Ambients