Skip to content

Conversation

@DTPelopones
Copy link

No description provided.

val catsLiveData: LiveData<Fact> = _catsLiveData
private val _catsState =
MutableStateFlow<Result<Fact>>(Result.Error(IllegalStateException("No data")))
val catsState: StateFlow<Result<Fact>> = _catsState

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут лучше добавить .asStateFLow()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

поправил

_catsLiveData.value = it
}
}
catsRepository.listenForCatFacts()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сетевые ошибки нужно обработать на уровне репозитория, в идеале в VM должен прийти уже Result

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

доработано

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants