ObservableState

ObservableState is a read-only wrapper of a StateSubject. It can be used to provide assurances that the Subject itself cannot be accidentally retrieved via casting, but that accessors can still subscribe to the underlying Subject.

Inheritors

Properties

Link copied to clipboard
abstract val value: T

The current value of the property.

Functions

Link copied to clipboard
open fun asSingle(scheduler: Scheduler): Single<T>

Converts this Observable to a Single subscribing on the given Scheduler

Link copied to clipboard
open fun <R> async(block: (T, Observer<R>) -> Disposable): Observable<R>

Returns an observable that will emit values in a possibly asynchronous manner determined by the given block.

Link copied to clipboard
open fun buffered(count: Int): Observable<T>

Returns an observable that will buffer emissions until the buffer is full, at which point they will be emitted downstream.

Link copied to clipboard
open fun <R> callback(block: (T, Observer<R>) -> Unit): Observable<R>

Returns an observable that will emit values in a possibly asynchronous manner determined by the given block.

Link copied to clipboard
open fun <T2, R> combine(other: Observable<T2>, combiner: (T, T2) -> R): Observable<R>

Returns an observable that combines the emissions of this observable the given other. The downstream emission is the result of applying the combiner function to the latest emissions of both observables - and are only possible once both this and the other have emitted at least one value.

open fun <T2, T3, R> combine(other1: Observable<T2>, other2: Observable<T3>, combiner: (T, T2, T3) -> R): Observable<R>

Returns an observable that combines the emissions of this observable the given others. The downstream emission is the result of applying the combiner function to the latest emissions of both observables - and are only possible once all others have emitted at least one value.

Link copied to clipboard
open fun distinct(): Observable<T>

Returns an observable that only emits downstream when the newest emissions is not equal to the previous emission. Emissions will be compared using standard Objects.equals

open fun distinct(isEquals: (T, T) -> Boolean): Observable<T>

Returns an observable that only emits downstream when the newest emissions is not equal to the previous emission. Emissions will be compared using the provided isEquals function

Link copied to clipboard
open fun filter(predicate: (T) -> Boolean): Observable<T>

Returns an observable that filters out emissions that do not match the given predicate

Link copied to clipboard

Convenience method for converting an observable of nullable items, into an observable of non-nullable items.

Link copied to clipboard
open fun <R> flatMap(transform: (T) -> Observable<R>): Observable<R>

Returns an observable that applies the given transform to the source emissions to produce new observables - all emissions from the resulting observables will be emitted downstream.

Link copied to clipboard
open fun <R> flatMapLatest(transform: (T) -> Observable<R>): Observable<R>

Returns an observable that applies the given transform to the source emissions to produce a new observable - only emissions from the latest observable created by the transform will be emitted downstream.

Link copied to clipboard
open fun forEach(block: (T) -> Unit): Observable<T>

Returns an observable that will call the given block with each source emission, before passing the original emission downstream.

Link copied to clipboard
open fun <R> map(transform: (T) -> R): Observable<R>

Returns an observable that applies the given transform to each emission before passing it downstream.

Link copied to clipboard
open fun <R> mapNotNull(transform: (T) -> R?): Observable<R>

Returns an observable that applies the given transform to each emission before passing it downstream. Only emissions that are non-null after the application of the transform will be emitted downstream.

Link copied to clipboard
open fun <R> mapState(transform: (T) -> R): ObservableState<R>

Transforms the emissions and state of an existing ObservableState instance to a different type. Typically useful for extracting sub-properties of an existing ObservableState.

Link copied to clipboard

Convenience method that maps any incoming emission to Unit

Link copied to clipboard
open fun merge(other: Observable<T>): Observable<T>

Returns an observable that will propagate all source emissions downstream from this observable and from the given other.

Link copied to clipboard
open fun observeOn(scheduler: Scheduler): Observable<T>

Returns an observable that propagates emissions downstream on the given scheduler

Link copied to clipboard
open fun resubscribingWhile(predicate: (T) -> Boolean): Observable<T>

Returns an observable that will continually resubscribe until the predicate returns false.

Link copied to clipboard
open fun share(): Observable<T>
open fun share(replay: Int): Observable<T>

Returns an Observable that will share a single connection to the source Observable (this).

Link copied to clipboard
open fun startWith(vararg item: T): Observable<T>

Returns an observable that will emit all the given item values before making a subscription to the source observable.

Link copied to clipboard
abstract fun subscribe(observer: Observer<T>): Disposable

Subscribes the given observer to receive updates

Link copied to clipboard
open fun subscribeOn(scheduler: Scheduler): Observable<T>

Returns an observable that performs the subscription on the given scheduler

Link copied to clipboard
open fun subscribeOnce(observer: Observer<T>): Disposable

Subscribes the given observer to a single emission of the source.

Link copied to clipboard
open fun take(count: Int): Observable<T>

Returns an observable that emits only the specified number of events given by the provided count

Link copied to clipboard
open fun takeWhile(predicate: (T) -> Boolean): Observable<T>
open fun takeWhile(inclusive: Boolean, predicate: (T) -> Boolean): Observable<T>

Returns an observable that emits downstream up until the predicate returns false.