firstNotNull

suspend fun <T> Flow<T?>.firstNotNull(): T & Any(source)

Returns the first non-null element emitted by this Flow. Suspends until a non-null element is found.

Return

The first non-null element

Type Parameters

T

The type of elements in the flow

Throws

if the flow completes without emitting a non-null element