• Developer's Commute
  • Posts
  • Quick Question: Do you understand what is Dagger Hilt? - Developer's Commute

Quick Question: Do you understand what is Dagger Hilt? - Developer's Commute

Do you understand what is Dagger Hilt?


Android Interview Questions

Android Interview Huh?

If your interviewer asks " Explain Dagger Hilt? "

Here is how you do it:

What is @ Binds?

  • In the previous thread we have seen how to create @ Module

  • Now suppose Hilt already knows how to create an object (We have implemented @ Inject constructor on it)

  • We want to give this object from a module we simply use @ Binds

  • But remember the class and fun must be abstract

  • Since we already know how to create a Repository or our Usecase in this example

@ Inject in Repository

What are Named Qualifiers?

  • Suppose we have a different implementation that has @ provides inside our module

  • Dagger so no idea which one has to be implemented

  • Therefore we used Named Qualifiers to point out the exact object that needs to be injected (Similar to Dagger 2)