in the below, i am trying to lateinit a variable as shown. however after folloing some examples in the internet i understood the concept of it but however i received the below posted error message due to the code stated in the method setupCommRequestService()
error message:
assignment are not expressions kotlin and only expression are allowed
please have a look at the code posted below and please let me know how can i fix it
code
lateinit var initCommRequestService : Single<CommunicationRequestService>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupCommRequestService()
.map {
it.getAllPhotos()
}
}
fun setupCommRequestService() : Single<CommunicationRequestService> {
return initCommRequestService = CommunicationRequestService.initRetrofit(this@MainActivity)!!
}
}
fun setupCommRequestService(): Single<CommunicationRequestService> {
initCommRequestService = CommunicationRequestService.initRetrofit(this@MainActivity)!!
return initCommRequestService
}