singleOrNull

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

The terminal operator, that awaits for one and only one value to be published. Throws IllegalStateException for flow that contains more than one element.