You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AndroidX ViewModel library offers a viewModelScope extension function to provide an auto-cancelled CoroutineScope, but again, this CoroutineScope is hard-coded and uses Dispatchers.Main. This limitation needn't exist.
"addCloseable() API and a new constructor overload that allow you to add one or more Closeable objects to the ViewModel that will be closed when the ViewModel is cleared without requiring any manual work in onCleared()."
So you can pass in a Closable coroutinescope to a viewmodel's constructor.
The text was updated successfully, but these errors were encountered:
This is no longer true w/ Lifecycle 2.5.0+:
https://developer.android.com/jetpack/androidx/releases/lifecycle#2.5.0
"addCloseable() API and a new constructor overload that allow you to add one or more Closeable objects to the ViewModel that will be closed when the ViewModel is cleared without requiring any manual work in onCleared()."
So you can pass in a Closable coroutinescope to a viewmodel's constructor.
The text was updated successfully, but these errors were encountered: