使用 IO 时,我可以在 fx 块中使用continueOn
,dispatchers.io()
也Dispatchers.IO
可以混合使用。有首选方法吗?两者有什么区别吗?
注意:我也在使用协程集成来运行 IO
IO.fx {
effect { _viewState.postValue(ViewState.Loading) }.bind()
continueOn(dispatchers().io()) // dispatchers from Arrow
val repositoryDto: RepositoryDto = effect { service.getRepository() }.bind()
continueOn(Dispatchers.Default) // Dispatchers from Coroutines
ViewState.Content(repositoryDto)
}