sujin
11/10/2019, 10:06 AMgildor
11/10/2019, 10:22 AMgildor
11/10/2019, 10:23 AMsujin
11/10/2019, 10:27 AMasync
function or withContext
? One in data layer and other in remote layer?gildor
11/10/2019, 12:38 PMgildor
11/10/2019, 12:39 PMgildor
11/10/2019, 2:55 PMrkeazor
11/10/2019, 2:57 PMsujin
11/11/2019, 5:51 AMsuspend fun someDataRepositoryFunction() {
withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
remoteRepository.someRemoteRepositoryFetchPosts()
}
}
suspend fun someRemoteRepositoryFetchPosts() {
val posts = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
apiService.fetchPost()
}
return someDataTrasformationFunction(posts)
}
What i am trying to say is, inorder to transform data in remote layer, do I have to do something like this or is there anyother better way to handle this. Notice the nested <http://Dispatchers.IO|Dispatchers.IO>
gildor
11/11/2019, 6:01 AMgildor
11/11/2019, 6:02 AMgildor
11/11/2019, 6:04 AM