rxMaybe

fun <T> rxMaybe(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T?): Maybe<T>(source)

Creates cold maybe that will run a given block in a coroutine and emits its result. If block result is null, onComplete is invoked without a value. Every time the returned observable is subscribed, it starts a new coroutine. Unsubscribing cancels running coroutine. Coroutine context can be specified with context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. Method throws IllegalArgumentException if provided context contains a Job instance.