November 2018
Intermediate to advanced
388 pages
9h 5m
English
@Inject is used to inject the required dependencies. For example, let's say there are two classes—IdGenerator and Identity. IdGenerator has to be injected into the Identity class. We can use @Inject for this without having to instantiate the IdGenerator inside the Identity class.
This is shown in the following code:
class Identity { @Inject private lateinit var idGenerator: IdGenerator}
Read now
Unlock full access