Hilt Inject field into any class with no scope

Viewed 412

Suppose that I have a class A

class A ()

I want to inject an instance of A as a field into class B and let Hilt or Dagger to handle it.

Class B {

  @Inject lateinit var a: A 

}

Let say class B is a plain class, has no context, e.g viewmodel or anything, what are the proper steps (if possible) so I can use the instance a without manual init.

1 Answers
Related