-
-
Save NoNews/1d62914a597a18934a53d453f4e7bb6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.flow.internal.unsafeFlow as flow | |
public fun <T> flowOf(value: T): Flow<T> = flow { | |
emit(value) | |
} | |
internal inline fun <T> unsafeFlow(crossinline block: suspend FlowCollector<T>.() -> Unit): Flow<T> { | |
return object : Flow<T> { | |
override suspend fun collect(collector: FlowCollector<T>) { | |
collector.block() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment