If you want to pass parameters to the screen's ViewModel, you should use AssistedInjection in the ViewModel. This allows you to inject dependencies as well as additional parameters when creating the ViewModel. Here's an example:
Full example of AssistedInjection you can find here
Middleware
If you want to use Middleware with injection, you should first obtain the Application Component from Hilt and then pass it to the Router. To do this, modify the App class as shown in the example below:
@HiltAndroidAppclassApp: ComposeApplication<RouterComponentImpl>(){lateinitvar component: AppComponent// Shared component for the Middleware controllersoverridefunonCreateComponent() {super.onCreateComponent()// Create it like the Hilt's documentation says component = EntryPoints.get(this, AppComponent::class.java) }overridefunonCreateRouter() { routerComponent =RouterComponentImpl() routerComponent.initialize(MainPath(), { _, _ ->AnimationControllerComposeSlide() }, component) }}