takeUntil

inline fun <T> LiveData<T>.takeUntil(crossinline predicate: (T?) -> Boolean): LiveData<T>

Takes until a certain predicate is met, and does not emit anything after that, whatever the value.