Created
April 11, 2022 13:43
-
-
Save skydoves/f8b0beafea811095cb4fd1c7ed667fc6 to your computer and use it in GitHub Desktop.
network_result_extensions_usecase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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