Как вернуться к запуску внутри сбора?Android

Форум для тех, кто программирует под Android
Anonymous
Как вернуться к запуску внутри сбора?

Сообщение Anonymous »

У меня есть метод, который выглядит так:

Код: Выделить всё

private lateinit var cards: List

fun start() = viewModelScope.launch {
if (!::cards.isInitialized) {
getCards().collect { result ->
result
.doIfSuccess {
cards = it.data
Log.d(TAG, "Received cards")
}
.doIfError {
_errorState.setIfNotEqual(it.exception)
Log.e(TAG, "Cards were not received because of ${it.exception}")
return@collect // 

Подробнее здесь: [url]https://stackoverflow.com/questions/67408311/how-to-return-to-launch-inside-of-the-collect[/url]

Вернуться в «Android»