Following code report property must be initialized or be abstract error.
// MyApi.kt
interface MyApi {
...
}
// MyFetch.kt
class MyFetch {
private val myApi: MyApi // <- this line
...
}
It can use lateinit statement in mutable variable, but how should I predefined in val?
You can use lazy, or make it nullable
private val myApi: MyApi? = null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With