Kotlin, wait callback one by one
I have method, which returns response from server. For example:
fun uploadVideo(link: String, completionHandler: (Result) -> Unit) {
// some action
completionHandler(Result.success(""))
}
I want to call this method one by one. Wait for a response from the previous one to call the next one. For example
uploadVideo("
https://stackoverflow.com/video1.mp4") {
}
// call this only when i have response from preview request
uploadVideo("
https://stackoverflow.com/video2.mp4") {
}
// call this...