observeNullable

fun <T> ComponentActivity.observeNullable(liveData: LiveData<T>, action: (T?) -> Unit)(source)
fun <T> View.observeNullable(liveData: LiveData<T>, action: (T?) -> Unit)(source)

NOTE: Only one observer at a time per value


fun <T, V : ViewBinding> BaseFragment<V>.observeNullable(liveData: LiveData<T>, action: (T?) -> Unit)(source)

Attaches an observable to the root binding, instead of the fragment. This is more efficient as it will not call observe if the view is in the background.

NOTE: Only one observer at a time per value