Kotlin and Dagger: Can I use @Inject to an object still make it nullable/optional?
I had the same problem and solved like this:
@Inject
@JvmField
var presenter: Presenter? = null
Hope it helps.
If you don't have Java code that needs to access the presenter
field you don't need to annotate it with @JvmField
. Instead, you can declare your field like so:
@set:Inject
var presenter: Presenter? = null