awaitFirstOrElse

suspend fun <T> Observable<T>.awaitFirstOrElse(
    defaultValue: () -> T
): T

Awaits for the first value from the given observable or call defaultValue to get a value if none is emitted without blocking a thread and returns the resulting value or throws the corresponding exception if this observable had produced error.

This suspending function is cancellable. If the Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function immediately resumes with CancellationException.