We have a list of operations that is async in nature. We want to finish all the operation lets say and want to do another task. I am totally new to Kotlin Coroutines concept and unable to achieve this task. I searched out a lot on the internet but since I have no overall experience with kotlin coroutines or another async service of kotlin to do this. Anyone has any idea how to achieve this task will be very helpful. Lets say I have 20 elements in the list and I want to do an operation on each element which is async in nature.
response.data?.let { dataArray ->
if (dataArray.isNotEmpty()) {
it.forEach {
it.unpair().done{
// Async call.
}
}
// All async operation completed do another task.
} else {
// Array is empty.
}
}