Dominaezzz
@ExperimentalCoroutinesApi internal fun <T> Flow<T?>.coalesce(other: Flow<T>): Flow<T> { return distinctUntilChanged { old, new -> old == null && new == null } .transformLatest { if (it != null) { // TODO: Will "Latest" wrongly cancel this branch? emit(it) } else { emitAll(other) } } }
ephemient
.flatMapLatest { flowOf(it ?: return@flatMapLatest other) }
A modern programming language that makes developers happier.