//Extensions for Jetpack Lifecycle/it.czerwinski.android.lifecycle.livedata/filter

filter

[androidJvm]
Content
fun <T> LiveData<T>.filter(predicate: (T) -> Boolean): LiveData<T>
More info

Returns a LiveData emitting only values from this LiveData matching the given predicate.

predicate will be executed on the main thread.

Example:

val resultLiveData: LiveData<Try> = ... val successLiveData: LiveData<Try> = resultLiveData.filter { it.isSuccess }