diff --git a/kotlinx-coroutines-core/common/src/flow/Builders.kt b/kotlinx-coroutines-core/common/src/flow/Builders.kt index 294044d875..5c01d00973 100644 --- a/kotlinx-coroutines-core/common/src/flow/Builders.kt +++ b/kotlinx-coroutines-core/common/src/flow/Builders.kt @@ -204,16 +204,17 @@ public fun LongRange.asFlow(): Flow = flow { */ @FlowPreview @Deprecated( - message = "Use channelFlow instead", - level = DeprecationLevel.WARNING, - replaceWith = ReplaceWith("channelFlow(block)") + message = "Use channelFlow with awaitClose { } instead of flowViaChannel and invokeOnClose { }.", + level = DeprecationLevel.WARNING ) +@Suppress("DeprecatedCallableAddReplaceWith") public fun flowViaChannel( bufferSize: Int = BUFFERED, @BuilderInference block: CoroutineScope.(channel: SendChannel) -> Unit ): Flow { return channelFlow { block(channel) + awaitClose() }.buffer(bufferSize) } @@ -327,4 +328,4 @@ private class ChannelFlowBuilder( override fun toString(): String = "block[$block] -> ${super.toString()}" -} \ No newline at end of file +}