с#
withContext, coroutineScope и прочееfun sendMessage() = withContext(...) {
}
fun another() = coroutineScope {
}
Size: a a a
с#
withContext, coroutineScope и прочееI
(
fun shoditbVSetb() = scope.launch {
val result = iduVSetb()
withContext(Dispatchers.Main) {
updateUI(result)
}
}с#
fun shoditbVSetb() = scope.launch {
val result = iduVSetb()
withContext(Dispatchers.Main) {
updateUI(result)
}
}AG
fun shoditbVSetb() = scope.launch {
val result = iduVSetb()
withContext(Dispatchers.Main) {
updateUI(result)
}
}(
с#
ML
I
(
ML
с#
(
с#
AM
withContext, coroutineScope и прочее(
fun shoditbVSetbCached() = scope.launch {
val result = iduVSetb()
withContext(dbWriteContext) {
writeToDb(result)
withContext(Dispatchers.Main) {
updateUI(result)
}
}с#
с#
fun shoditbVSetbCached() = scope.launch {
val result = iduVSetb()
withContext(dbWriteContext) {
writeToDb(result)
withContext(Dispatchers.Main) {
updateUI(result)
}
}fun shoditbVSetbCached() = scope.launch {
val result = iduVSetb()
withContext(dbWriteContext) {
writeToDb(result)
}
// будет вызвано после завершения контекста выше
withContext(Dispatchers.Main) {
updateUI(result)
}
}AM