Prateek Kumar
10/18/2023, 5:26 AMfun CoroutineScope.ioLaunch(
launchBody: suspend CoroutineScope.() -> Unit
): Job {
return this.launch(context = <http://Dispatchers.IO|Dispatchers.IO>, block = launchBody)
}
viewmodelScope.ioLaunch{
//Do things
}
Because when using StateFlow , we can update it from any thread and UI will not breakxoangon
10/18/2023, 6:13 AMPrateek Kumar
10/18/2023, 6:17 AMxoangon
10/18/2023, 6:34 AMsequence
builder function as an example. That function has a suspend
function type as an argument that allows for declaring algorithms to create infinite collections in a yield-based stylexoangon
10/18/2023, 6:35 AMDispatchers.default
and that's also not IOceedee
10/18/2023, 7:39 AM