Kotlin and Dagger: Can I use @Inject to an object still make it nullable/optional?

后端 未结 2 1467
心在旅途
心在旅途 2020-12-30 05:52

I need something that can make my class nullable/optional because of the runtime errors that is happening on some devices.

Is this possible?

class M         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-30 06:40

    I had the same problem and solved like this:

    @Inject
    @JvmField
    var presenter: Presenter? = null
    

    Hope it helps.

提交回复
热议问题