Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created April 11, 2022 13:43
Show Gist options
  • Save skydoves/f8b0beafea811095cb4fd1c7ed667fc6 to your computer and use it in GitHub Desktop.
Save skydoves/f8b0beafea811095cb4fd1c7ed667fc6 to your computer and use it in GitHub Desktop.
network_result_extensions_usecase
viewModelScope.launch {
val response = posterRemoteDataSource.invoke()
response.onSuccess { posterList ->
posterFlow.emit(posterList)
}.onError { code, message ->
errorFlow.emit("$code $message")
}.onException {
errorFlow.emit("${it.message}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment