awaitLast

suspend fun <T> ObservableSource<T & Any>.awaitLast(): T(source)

Awaits the last value from the given Observable without blocking the thread and returns the resulting value, or, if this observable has produced an error, throws the corresponding exception.

This suspending function is cancellable. If the Job of the current coroutine is cancelled while the suspending function is waiting, this function immediately disposes of its subscription and resumes with CancellationException.

Throws

NoSuchElementException

if the observable does not emit any value