File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
kotlinx-coroutines-core/common/src/flow Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -204,16 +204,17 @@ public fun LongRange.asFlow(): Flow<Long> = flow {
204204 */
205205@FlowPreview
206206@Deprecated(
207- message = " Use channelFlow instead" ,
208- level = DeprecationLevel .WARNING ,
209- replaceWith = ReplaceWith (" channelFlow(block)" )
207+ message = " Use channelFlow with awaitClose { } instead of flowViaChannel and invokeOnClose { }." ,
208+ level = DeprecationLevel .WARNING
210209)
210+ @Suppress(" DeprecatedCallableAddReplaceWith" )
211211public fun <T > flowViaChannel (
212212 bufferSize : Int = BUFFERED ,
213213 @BuilderInference block : CoroutineScope .(channel: SendChannel <T >) -> Unit
214214): Flow <T > {
215215 return channelFlow<T > {
216216 block(channel)
217+ awaitClose()
217218 }.buffer(bufferSize)
218219}
219220
@@ -327,4 +328,4 @@ private class ChannelFlowBuilder<T>(
327328
328329 override fun toString (): String =
329330 " block[$block ] -> ${super .toString()} "
330- }
331+ }
You can’t perform that action at this time.
0 commit comments