We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
这个需要根据实际业务进行处理,比如说zip三个请求,如果其中一个业务code不正确,是忽略其中一个还是整体不成立,由业务觉决定。
fun request() = flow { emit(apiService.request()) } fun request2() = flow { emit(apiService.request2()) } fun request3() = flow { emit(apiService.request3()) } viewModelScope.launch { request() .zip(request()2){ r1,r2->{ val list= mutableListOf<String>() // 如果request() 返回code不成功 整体抛异常 if(r1.code ==0){ list.addAll(r1.data) }else{ throw nullExcpt } if(r2.code==0){ // 如果request2()返回code不成功,则忽略 list.addAll(r2.data) } return@zip list } .zip(request()3){ r12,r3-> } .catch{ } .collect { } } }
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: