IntermediateFlow

Flow map Operator

Transform flow values with map.

Dependency required: implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
kotlin
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*

fun main() = runBlocking {
    flowOf(1, 2, 3)
        .map { it * 2 }
        .collect { println(it) }
}
Output
2 4 6

Explanation

map transforms each emitted value. flowOf creates a flow from fixed values.