Back to Intellij Community

UnusedFlow

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/UnusedFlow.html

2025.3-rc-2416 B
Original Source

Reports Kotlinx Coroutines Flows that are created but never consumed or passed to other functions.

The code defining a Flow does not run unless the Flow is collected by using a terminal operator.

Example:

fun foo() {
    flowOf(1).onEach { println(it) }
}

See some examples of terminal operators.