Dependencies to composable and access to DestinationDependenciesContainer
See original GitHub issueBefore, in version 0.9.2, we could provide a DestinationDependenciesContainer
to a DestinationsNavHost
to provide some rudimentary dependency injection to Destinations.
It seems like this feature is no longer accessible unless I provide my own NavHostEngine due to the default enigine is creating a empty DestinationDependenciesContainer
by default. Is this a conscious design decision? I looked into using the manual compose calls but that easily becomes quite messy.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Compose and other libraries - Android Developers
To use Compose in an activity, you must use ComponentActivity ... you can access a ViewModel from any composable by calling the viewModel()...
Read more >Navigating through multi-module Jetpack Compose applications
Jetpack Compose, navigation, multi-module architecture, API and Impl modules, dependency injection — in this blog post, we will see how ...
Read more >Jetpack Compose How to access dependency injected view ...
In fragment /activity, you should wrap composable view with CompositionLocalProvider and provide the viewmodel instance to the view tree.
Read more >Navigation and Dependency Injection in Compose - Droidcon
Applying the lessons Square has learned about DI-friendly navigation patterns to Compose-first apps. Life gets better when you recognize ...
Read more >False positive "Cannot access class 'androidx.compose.ui ...
Cannot access class 'androidx.compose.ui.geometry.Offset'. Check your module classpath for missing or conflicting dependencies. floating in drawCricle() .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sounds, good! Thank you for the help and the nice library.
I see. At the moment, I think CompositionLocal is the correct solution for you then.
This specific code was not tested, so take it with a grain of salt.