I'm trying to use these two builders for coroutines in my app, but in my ViewModel I can't import them or they do not pop up.
These are my dependencies:
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0-rc02"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
and in my ViewModel
class MainViewModel(): ViewModel() {
init{
viewModelScope ----> does not work , marked in red
val data = liveData {} ----> does not work, marked in red
}
}
I rebuilt, cleaned, and restarted with invalidating cache, but I can't use them
Add the ViewModel ktx lib:
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx$lifecycle_version"
Available after AndroidX lifecycle v2.1.0
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