File tree 1 file changed +5
-4
lines changed
kotlinx-coroutines-core/common/src/flow
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 {
204
204
*/
205
205
@FlowPreview
206
206
@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
210
209
)
210
+ @Suppress(" DeprecatedCallableAddReplaceWith" )
211
211
public fun <T > flowViaChannel (
212
212
bufferSize : Int = BUFFERED ,
213
213
@BuilderInference block : CoroutineScope .(channel: SendChannel <T >) -> Unit
214
214
): Flow <T > {
215
215
return channelFlow<T > {
216
216
block(channel)
217
+ awaitClose()
217
218
}.buffer(bufferSize)
218
219
}
219
220
@@ -327,4 +328,4 @@ private class ChannelFlowBuilder<T>(
327
328
328
329
override fun toString (): String =
329
330
" block[$block ] -> ${super .toString()} "
330
- }
331
+ }
You can’t perform that action at this time.
0 commit comments