Skip to content
Advertisement

Tag: dagger-hilt

Passing runtime parameter to constructor in Hilt

In Dagger, we can pass the runtime parameter through component.builder. But how to achieve that in hilt where the Component is Built in? How to inject an object of ProgressData in the main activity while percent data is set in runtime? Answer I found the answer. First Annotate the constructor with @AssistedInject. then we have to annotate percent as @Assisted.

Advertisement