https://kotlinlang.org logo
#coroutines
Title
# coroutines
j

John

12/12/2019, 6:46 PM
What’s the right way to hold a coroutine until a listener is called? I.e. something like:
Copy code
fun suspend getCar(): Car {
    val returnedCard
    fetcher.getCar({ car ->
       returnedCar = car 
    })
    // await while car is fetched ???
    return returnedCar
}
r

Ruckus

12/12/2019, 6:54 PM
j

John

12/12/2019, 7:00 PM
Thanks!
13 Views