The use of this block is to provide a ViewModel in...
# android
g
The use of this block is to provide a ViewModel in an Activity and it's used like so:
Copy code
private val model: MyViewModel by viewModelProvider { MyViewModel(dependencies) }
g
Awesome!
g
@ashdavies what dependency is that from? I don't seem to get it with fragment-ktx, viewmodel-ktx or core-ktx
a
androidx.activity
😉
g
it's alpha https://mvnrepository.com/artifact/androidx.fragment/fragment-ktx but you might as well just copy the files into your project, it's not much.