but the only way I can await on RX is, I guess, th...
# coroutines
a
but the only way I can await on RX is, I guess, this
Copy code
suspend fun <T> Observable<T>.await(): T =
    suspendCoroutine { cont ->
      subscribe(object : Observer<T> {
        override fun onComplete() = Unit
        override fun onSubscribe(d: Disposable) = Unit
        override fun onError(e: Throwable) = cont.resumeWithException(e)
        override fun onNext(t: T) = cont.resume(t)
      })
    }