ObservationDefault

An Observation that implements MutableDefaultInitialized

Parameters

T

the type of value to expect.

R

the type of result to expect. Must be a subclass of T.

defaultValue

The default ObservableOptional.Value to return if the current value is ObservableOptional.Nothing or ObservableOptional.Value containing null.

initialValue

The initial ObservableOptional.Value this observation should contain.

Constructors

Link copied to clipboard
constructor(defaultValue: R, initialValue: ObservableOptional.Value<T?>)

Constructor

constructor(defaultValue: ObservableOptional.Value<R>, initialValue: ObservableOptional.Value<T?>)

Properties

Link copied to clipboard

Transformation to apply to the latest value when observedValue is called.

Link copied to clipboard
open override val current: R

The current value of R

Link copied to clipboard

The currently observed OO

Link copied to clipboard
open override val currentOrNull: R?

The current value T or null being observed

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The ObservableOptional or T that is currently being observed.

Link copied to clipboard

Action to execute when this observable is observed for the first time.

Link copied to clipboard
open override val stateFlow: MutableStateFlow<R>

StateFlow that expresses the content from the observable.

Link copied to clipboard
open override val valueDelegate: ReadWriteProperty<Any?, R>

A ReadOnlyProperty of T

Functions

Link copied to clipboard
open operator override fun getValue(thisRef: Any?, property: KProperty<*>): R
Link copied to clipboard
open override fun observe(onNext: (R?) -> Unit): Disposable

Adds an observing function to the Observable to be notified on each change to the observable. If there is a current value, there will be an immediate notification

Link copied to clipboard
open override fun observeInitialized(onNext: (R) -> Unit): Disposable
Link copied to clipboard
fun <T> WithState<T?>.observeNotNullOnLifecycle(lifecycleOwner: LifecycleOwner, filter: suspend (T) -> Boolean = { true }, onNext: (T) -> Unit): Job

Observes WithState of a nullable value on the lifecycle of a LifecycleOwner

Link copied to clipboard
fun <T> WithState<T>.observeOnLifecycle(lifecycleOwner: LifecycleOwner, filter: suspend (T) -> Boolean = { true }, onNext: (T) -> Unit): Job

Observes WithState on the lifecycle of a LifecycleOwner

fun <T, R> WithState<T>.observeOnLifecycle(lifecycleOwner: LifecycleOwner, filter: suspend (T) -> Boolean = { true }, transform: suspend (T) -> R, onNext: (R) -> Unit): Job

Observes WithState on the lifecycle of a LifecycleOwner by transforming the observed value.

Link copied to clipboard

set the value of this Observable from a suspended context.

open operator override fun setValue(thisRef: Any?, property: KProperty<*>, value: R)
Link copied to clipboard
fun <R : T, T> ReadWriteProperty<Any?, T?>.toDefaultSubject(defaultValue: R, coroutineScope: CoroutineScope? = null, context: CoroutineContext? = coroutineScope?.coroutineContext): ReadWritePropertyDefaultSubject<R, T?>
Link copied to clipboard
fun <T> ReadWriteProperty<Any?, T>.toInitializedSubject(coroutineScope: CoroutineScope? = null, context: CoroutineContext? = coroutineScope?.coroutineContext): ReadWritePropertyInitializedSubject<T>