observe

fun <T> observe(initial: T, emitOnDistinct: Boolean = true): MutableObservable<T>

Creates and returns a new instance of a MutableObservable initialized with the given value. The resulting observable allows its state to be modified and notifies registered observers of any changes.

Return

A new instance of MutableObservable initialized with the provided value.

Parameters

initial

The initial value of the observable.

Type Parameters

T

The type of the value being observed.