anko icon indicating copy to clipboard operation
anko copied to clipboard

await() is not found in 0.10.5

Open dj-4war opened this issue 6 years ago • 1 comments

I am using 0.10.5 version on in my app.

I would like to do things in Coroutine in different thread till it gets it out come.

val compleated = false val needoOutcome = doAsync{ }

I need to await() till doAsync gets completed.

Please let me know what is the equivalent method for awai()

dj-4war avatar Aug 06 '18 18:08 dj-4war

Please make sure you call await() inside a coroutine, because it needs to suspend until the computation finishes, and only coroutines can suspend in a non-blocking way. As a matter of fact, doAsync returns a Future object, if you don't want to use coroutine, you can hook it up with RxJava, see this.

iceboundrock avatar Dec 18 '18 22:12 iceboundrock