@@ -44,7 +44,7 @@ import kotlin.jvm.*
44
44
* ```
45
45
* If you want to switch the context of execution of a flow, use the [flowOn] operator.
46
46
*/
47
- @FlowPreview
47
+ @ExperimentalCoroutinesApi
48
48
public fun <T > flow (@BuilderInference block : suspend FlowCollector <T >.() -> Unit ): Flow <T > {
49
49
return object : Flow <T > {
50
50
override suspend fun collect (collector : FlowCollector <T >) {
@@ -57,7 +57,6 @@ public fun <T> flow(@BuilderInference block: suspend FlowCollector<T>.() -> Unit
57
57
* An analogue of the [flow] builder that does not check the context of execution of the resulting flow.
58
58
* Used in our own operators where we trust the context of invocations.
59
59
*/
60
- @FlowPreview
61
60
@PublishedApi
62
61
internal inline fun <T > unsafeFlow (@BuilderInference crossinline block : suspend FlowCollector <T >.() -> Unit ): Flow <T > {
63
62
return object : Flow <T > {
@@ -91,7 +90,7 @@ public fun <T> (suspend () -> T).asFlow(): Flow<T> = unsafeFlow {
91
90
/* *
92
91
* Creates a flow that produces values from the given iterable.
93
92
*/
94
- @FlowPreview
93
+ @ExperimentalCoroutinesApi
95
94
public fun <T > Iterable<T>.asFlow (): Flow <T > = unsafeFlow {
96
95
forEach { value ->
97
96
emit(value)
@@ -101,7 +100,7 @@ public fun <T> Iterable<T>.asFlow(): Flow<T> = unsafeFlow {
101
100
/* *
102
101
* Creates a flow that produces values from the given iterable.
103
102
*/
104
- @FlowPreview
103
+ @ExperimentalCoroutinesApi
105
104
public fun <T > Iterator<T>.asFlow (): Flow <T > = unsafeFlow {
106
105
forEach { value ->
107
106
emit(value)
@@ -111,7 +110,7 @@ public fun <T> Iterator<T>.asFlow(): Flow<T> = unsafeFlow {
111
110
/* *
112
111
* Creates a flow that produces values from the given sequence.
113
112
*/
114
- @FlowPreview
113
+ @ExperimentalCoroutinesApi
115
114
public fun <T > Sequence<T>.asFlow (): Flow <T > = unsafeFlow {
116
115
forEach { value ->
117
116
emit(value)
@@ -121,7 +120,7 @@ public fun <T> Sequence<T>.asFlow(): Flow<T> = unsafeFlow {
121
120
/* *
122
121
* Creates a flow that produces values from the given array of elements.
123
122
*/
124
- @FlowPreview
123
+ @ExperimentalCoroutinesApi
125
124
public fun <T > flowOf (vararg elements : T ): Flow <T > = unsafeFlow {
126
125
for (element in elements) {
127
126
emit(element)
@@ -131,7 +130,7 @@ public fun <T> flowOf(vararg elements: T): Flow<T> = unsafeFlow {
131
130
/* *
132
131
* Creates flow that produces a given [value].
133
132
*/
134
- @FlowPreview
133
+ @ExperimentalCoroutinesApi
135
134
public fun <T > flowOf (value : T ): Flow <T > = unsafeFlow {
136
135
/*
137
136
* Implementation note: this is just an "optimized" overload of flowOf(vararg)
@@ -143,7 +142,7 @@ public fun <T> flowOf(value: T): Flow<T> = unsafeFlow {
143
142
/* *
144
143
* Returns an empty flow.
145
144
*/
146
- @FlowPreview
145
+ @ExperimentalCoroutinesApi
147
146
public fun <T > emptyFlow (): Flow <T > = EmptyFlow
148
147
149
148
private object EmptyFlow : Flow<Nothing> {
@@ -153,7 +152,7 @@ private object EmptyFlow : Flow<Nothing> {
153
152
/* *
154
153
* Creates a flow that produces values from the given array.
155
154
*/
156
- @FlowPreview
155
+ @ExperimentalCoroutinesApi
157
156
public fun <T > Array<T>.asFlow (): Flow <T > = unsafeFlow {
158
157
forEach { value ->
159
158
emit(value)
@@ -163,7 +162,7 @@ public fun <T> Array<T>.asFlow(): Flow<T> = unsafeFlow {
163
162
/* *
164
163
* Creates flow that produces values from the given array.
165
164
*/
166
- @FlowPreview
165
+ @ExperimentalCoroutinesApi
167
166
public fun IntArray.asFlow (): Flow <Int > = unsafeFlow {
168
167
forEach { value ->
169
168
emit(value)
@@ -173,7 +172,7 @@ public fun IntArray.asFlow(): Flow<Int> = unsafeFlow {
173
172
/* *
174
173
* Creates flow that produces values from the given array.
175
174
*/
176
- @FlowPreview
175
+ @ExperimentalCoroutinesApi
177
176
public fun LongArray.asFlow (): Flow <Long > = unsafeFlow {
178
177
forEach { value ->
179
178
emit(value)
@@ -183,7 +182,7 @@ public fun LongArray.asFlow(): Flow<Long> = unsafeFlow {
183
182
/* *
184
183
* Creates flow that produces values from the given range.
185
184
*/
186
- @FlowPreview
185
+ @ExperimentalCoroutinesApi
187
186
public fun IntRange.asFlow (): Flow <Int > = unsafeFlow {
188
187
forEach { value ->
189
188
emit(value)
@@ -193,7 +192,7 @@ public fun IntRange.asFlow(): Flow<Int> = unsafeFlow {
193
192
/* *
194
193
* Creates flow that produces values from the given range.
195
194
*/
196
- @FlowPreview
195
+ @ExperimentalCoroutinesApi
197
196
public fun LongRange.asFlow (): Flow <Long > = flow {
198
197
forEach { value ->
199
198
emit(value)
@@ -262,7 +261,7 @@ public fun <T> flowViaChannel(
262
261
* }
263
262
* ```
264
263
*/
265
- @FlowPreview
264
+ @ExperimentalCoroutinesApi
266
265
public fun <T > channelFlow (@BuilderInference block : suspend ProducerScope <T >.() -> Unit ): Flow <T > =
267
266
ChannelFlowBuilder (block)
268
267
@@ -310,6 +309,7 @@ public fun <T> channelFlow(@BuilderInference block: suspend ProducerScope<T>.()
310
309
* ```
311
310
*/
312
311
@Suppress(" NOTHING_TO_INLINE" )
312
+ @ExperimentalCoroutinesApi
313
313
public inline fun <T > callbackFlow (@BuilderInference noinline block : suspend ProducerScope <T >.() -> Unit ): Flow <T > =
314
314
channelFlow(block)
315
315
0 commit comments