You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
-10
Original file line number
Diff line number
Diff line change
@@ -889,8 +889,6 @@ public final class kotlinx/coroutines/flow/FlowKt {
889
889
public static final fun asFlow ([Ljava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
890
890
public static final fun asSharedFlow (Lkotlinx/coroutines/flow/MutableSharedFlow;)Lkotlinx/coroutines/flow/SharedFlow;
891
891
public static final fun asStateFlow (Lkotlinx/coroutines/flow/MutableStateFlow;)Lkotlinx/coroutines/flow/StateFlow;
892
-
public static final fun broadcastIn (Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlinx/coroutines/CoroutineStart;)Lkotlinx/coroutines/channels/BroadcastChannel;
893
-
public static synthetic fun broadcastIn$default (Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlinx/coroutines/CoroutineStart;ILjava/lang/Object;)Lkotlinx/coroutines/channels/BroadcastChannel;
894
892
public static final synthetic fun buffer (Lkotlinx/coroutines/flow/Flow;I)Lkotlinx/coroutines/flow/Flow;
895
893
public static final fun buffer (Lkotlinx/coroutines/flow/Flow;ILkotlinx/coroutines/channels/BufferOverflow;)Lkotlinx/coroutines/flow/Flow;
896
894
public static synthetic fun buffer$default (Lkotlinx/coroutines/flow/Flow;IILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
@@ -961,10 +959,6 @@ public final class kotlinx/coroutines/flow/FlowKt {
961
959
public static final fun flowOf (Ljava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
962
960
public static final fun flowOf ([Ljava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
963
961
public static final fun flowOn (Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/CoroutineContext;)Lkotlinx/coroutines/flow/Flow;
964
-
public static final fun flowViaChannel (ILkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
965
-
public static synthetic fun flowViaChannel$default (ILkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
966
-
public static final fun flowWith (Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/CoroutineContext;ILkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/flow/Flow;
967
-
public static synthetic fun flowWith$default (Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/CoroutineContext;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
968
962
public static final fun fold (Lkotlinx/coroutines/flow/Flow;Ljava/lang/Object;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
969
963
public static final fun forEach (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;)V
970
964
public static final fun getDEFAULT_CONCURRENCY ()I
@@ -981,8 +975,6 @@ public final class kotlinx/coroutines/flow/FlowKt {
981
975
public static final fun onCompletion (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
982
976
public static final fun onEach (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
983
977
public static final fun onEmpty (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
984
-
public static final fun onErrorCollect (Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/flow/Flow;
985
-
public static synthetic fun onErrorCollect$default (Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
986
978
public static final fun onErrorResume (Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
987
979
public static final fun onErrorResumeNext (Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
988
980
public static final fun onErrorReturn (Lkotlinx/coroutines/flow/Flow;Ljava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
@@ -998,9 +990,7 @@ public final class kotlinx/coroutines/flow/FlowKt {
998
990
public static final fun reduce (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
999
991
public static final fun replay (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
1000
992
public static final fun replay (Lkotlinx/coroutines/flow/Flow;I)Lkotlinx/coroutines/flow/Flow;
1001
-
public static final synthetic fun retry (Lkotlinx/coroutines/flow/Flow;ILkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/flow/Flow;
1002
993
public static final fun retry (Lkotlinx/coroutines/flow/Flow;JLkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
1003
-
public static synthetic fun retry$default (Lkotlinx/coroutines/flow/Flow;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
1004
994
public static synthetic fun retry$default (Lkotlinx/coroutines/flow/Flow;JLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
1005
995
public static final fun retryWhen (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function4;)Lkotlinx/coroutines/flow/Flow;
1006
996
public static final fun runningFold (Lkotlinx/coroutines/flow/Flow;Ljava/lang/Object;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
Copy file name to clipboardExpand all lines: kotlinx-coroutines-core/common/src/flow/operators/Context.kt
-58
Original file line number
Diff line number
Diff line change
@@ -277,64 +277,6 @@ private class CancellableFlowImpl<T>(private val flow: Flow<T>) : CancellableFlo
277
277
}
278
278
}
279
279
280
-
/**
281
-
* The operator that changes the context where all transformations applied to the given flow within a [builder] are executed.
282
-
* This operator is context preserving and does not affect the context of the preceding and subsequent operations.
283
-
*
284
-
* Example:
285
-
*
286
-
* ```
287
-
* flow // not affected
288
-
* .map { ... } // Not affected
289
-
* .flowWith(Dispatchers.IO) {
290
-
* map { ... } // in IO
291
-
* .filter { ... } // in IO
292
-
* }
293
-
* .map { ... } // Not affected
294
-
* ```
295
-
*
296
-
* For more explanation of context preservation please refer to [Flow] documentation.
297
-
*
298
-
* This operator is deprecated without replacement because it was discovered that it doesn't play well with coroutines
299
-
* and flow semantics:
300
-
*
301
-
* 1) It doesn't prevent context elements from the downstream to leak into its body
302
-
* ```
303
-
* flowOf(1).flowWith(EmptyCoroutineContext) {
304
-
* onEach { println(kotlin.coroutines.coroutineContext[CoroutineName]) } // Will print 42
305
-
* }.flowOn(CoroutineName(42))
306
-
* ```
307
-
* 2) To avoid such leaks, new primitive should be introduced to `kotlinx.coroutines` -- the subtraction of contexts.
308
-
* And this will become a new concept to learn, maintain and explain.
309
-
* 3) It defers the execution of declarative [builder] until the moment of [collection][Flow.collect] similarly
310
-
* to `Observable.defer`. But it is unexpected because nothing in the name `flowWith` reflects this fact.
311
-
* 4) It can be confused with [flowOn] operator, though [flowWith] is much rarer.
312
-
*
313
-
* @suppress
314
-
*/
315
-
@FlowPreview
316
-
@Deprecated(message ="flowWith is deprecated without replacement, please refer to its KDoc for an explanation", level =DeprecationLevel.ERROR) // Error in beta release, removal in 1.4
317
-
publicfun <T, R> Flow<T>.flowWith(
318
-
flowContext:CoroutineContext,
319
-
bufferSize:Int = BUFFERED,
320
-
builder:Flow<T>.() ->Flow<R>
321
-
): Flow<R> {
322
-
checkFlowContext(flowContext)
323
-
val source =this
324
-
return unsafeFlow {
325
-
/**
326
-
* Here we should remove a Job instance from the context.
327
-
* All builders are written using scoping and no global coroutines are launched, so it is safe not to provide explicit Job.
328
-
* It is also necessary not to mess with cancellation if multiple flowWith are used.
329
-
*/
330
-
val originalContext = currentCoroutineContext().minusKey(Job)
331
-
val prepared = source.flowOn(originalContext).buffer(bufferSize)
332
-
builder(prepared).flowOn(flowContext).buffer(bufferSize).collect { value ->
0 commit comments