@@ -44,7 +44,7 @@ import kotlin.jvm.*
4444 * ```
4545 * If you want to switch the context of execution of a flow, use the [flowOn] operator.
4646 */
47- @FlowPreview
47+ @ExperimentalCoroutinesApi
4848public fun <T > flow (@BuilderInference block : suspend FlowCollector <T >.() -> Unit ): Flow <T > {
4949 return object : Flow <T > {
5050 override suspend fun collect (collector : FlowCollector <T >) {
@@ -57,7 +57,6 @@ public fun <T> flow(@BuilderInference block: suspend FlowCollector<T>.() -> Unit
5757 * An analogue of the [flow] builder that does not check the context of execution of the resulting flow.
5858 * Used in our own operators where we trust the context of invocations.
5959 */
60- @FlowPreview
6160@PublishedApi
6261internal inline fun <T > unsafeFlow (@BuilderInference crossinline block : suspend FlowCollector <T >.() -> Unit ): Flow <T > {
6362 return object : Flow <T > {
@@ -91,7 +90,7 @@ public fun <T> (suspend () -> T).asFlow(): Flow<T> = unsafeFlow {
9190/* *
9291 * Creates a flow that produces values from the given iterable.
9392 */
94- @FlowPreview
93+ @ExperimentalCoroutinesApi
9594public fun <T > Iterable<T>.asFlow (): Flow <T > = unsafeFlow {
9695 forEach { value ->
9796 emit(value)
@@ -101,7 +100,7 @@ public fun <T> Iterable<T>.asFlow(): Flow<T> = unsafeFlow {
101100/* *
102101 * Creates a flow that produces values from the given iterable.
103102 */
104- @FlowPreview
103+ @ExperimentalCoroutinesApi
105104public fun <T > Iterator<T>.asFlow (): Flow <T > = unsafeFlow {
106105 forEach { value ->
107106 emit(value)
@@ -111,7 +110,7 @@ public fun <T> Iterator<T>.asFlow(): Flow<T> = unsafeFlow {
111110/* *
112111 * Creates a flow that produces values from the given sequence.
113112 */
114- @FlowPreview
113+ @ExperimentalCoroutinesApi
115114public fun <T > Sequence<T>.asFlow (): Flow <T > = unsafeFlow {
116115 forEach { value ->
117116 emit(value)
@@ -121,7 +120,7 @@ public fun <T> Sequence<T>.asFlow(): Flow<T> = unsafeFlow {
121120/* *
122121 * Creates a flow that produces values from the given array of elements.
123122 */
124- @FlowPreview
123+ @ExperimentalCoroutinesApi
125124public fun <T > flowOf (vararg elements : T ): Flow <T > = unsafeFlow {
126125 for (element in elements) {
127126 emit(element)
@@ -131,7 +130,7 @@ public fun <T> flowOf(vararg elements: T): Flow<T> = unsafeFlow {
131130/* *
132131 * Creates flow that produces a given [value].
133132 */
134- @FlowPreview
133+ @ExperimentalCoroutinesApi
135134public fun <T > flowOf (value : T ): Flow <T > = unsafeFlow {
136135 /*
137136 * Implementation note: this is just an "optimized" overload of flowOf(vararg)
@@ -143,7 +142,7 @@ public fun <T> flowOf(value: T): Flow<T> = unsafeFlow {
143142/* *
144143 * Returns an empty flow.
145144 */
146- @FlowPreview
145+ @ExperimentalCoroutinesApi
147146public fun <T > emptyFlow (): Flow <T > = EmptyFlow
148147
149148private object EmptyFlow : Flow<Nothing> {
@@ -153,7 +152,7 @@ private object EmptyFlow : Flow<Nothing> {
153152/* *
154153 * Creates a flow that produces values from the given array.
155154 */
156- @FlowPreview
155+ @ExperimentalCoroutinesApi
157156public fun <T > Array<T>.asFlow (): Flow <T > = unsafeFlow {
158157 forEach { value ->
159158 emit(value)
@@ -163,7 +162,7 @@ public fun <T> Array<T>.asFlow(): Flow<T> = unsafeFlow {
163162/* *
164163 * Creates flow that produces values from the given array.
165164 */
166- @FlowPreview
165+ @ExperimentalCoroutinesApi
167166public fun IntArray.asFlow (): Flow <Int > = unsafeFlow {
168167 forEach { value ->
169168 emit(value)
@@ -173,7 +172,7 @@ public fun IntArray.asFlow(): Flow<Int> = unsafeFlow {
173172/* *
174173 * Creates flow that produces values from the given array.
175174 */
176- @FlowPreview
175+ @ExperimentalCoroutinesApi
177176public fun LongArray.asFlow (): Flow <Long > = unsafeFlow {
178177 forEach { value ->
179178 emit(value)
@@ -183,7 +182,7 @@ public fun LongArray.asFlow(): Flow<Long> = unsafeFlow {
183182/* *
184183 * Creates flow that produces values from the given range.
185184 */
186- @FlowPreview
185+ @ExperimentalCoroutinesApi
187186public fun IntRange.asFlow (): Flow <Int > = unsafeFlow {
188187 forEach { value ->
189188 emit(value)
@@ -193,7 +192,7 @@ public fun IntRange.asFlow(): Flow<Int> = unsafeFlow {
193192/* *
194193 * Creates flow that produces values from the given range.
195194 */
196- @FlowPreview
195+ @ExperimentalCoroutinesApi
197196public fun LongRange.asFlow (): Flow <Long > = flow {
198197 forEach { value ->
199198 emit(value)
@@ -262,7 +261,7 @@ public fun <T> flowViaChannel(
262261 * }
263262 * ```
264263 */
265- @FlowPreview
264+ @ExperimentalCoroutinesApi
266265public fun <T > channelFlow (@BuilderInference block : suspend ProducerScope <T >.() -> Unit ): Flow <T > =
267266 ChannelFlowBuilder (block)
268267
@@ -310,6 +309,7 @@ public fun <T> channelFlow(@BuilderInference block: suspend ProducerScope<T>.()
310309 * ```
311310 */
312311@Suppress(" NOTHING_TO_INLINE" )
312+ @ExperimentalCoroutinesApi
313313public inline fun <T > callbackFlow (@BuilderInference noinline block : suspend ProducerScope <T >.() -> Unit ): Flow <T > =
314314 channelFlow(block)
315315
0 commit comments