onStart

@ExperimentalCoroutinesApi fun <T> Flow<T>.onStart(
    action: suspend FlowCollector<T>.() -> Unit
): Flow<T>
(source)

Invokes the given action when the this flow starts to be collected.

The receiver of the action is FlowCollector and thus onStart can emit additional elements. For example:

flowOf("a", "b", "c")
    .onStart { emit("Begin") }
    .collect { println(it) } // prints Begin, a, b, c