Hello. Are there `StateFlow` builders similar to `...
# announcements
m
Hello. Are there
StateFlow
builders similar to
callbackFlow
? I'm trying to transform this code to use a
StateFlow
instead of a `Flow`:
Copy code
fun <T> ObservableValue<T>.values(): Flow<T> = callbackFlow {
    val listener = javafx.beans.value.ChangeListener<T> { _, _, newValue ->
        offer(newValue)
    }

    addListener(listener)

    awaitClose { removeListener(listener) }
}
f
Use
stateIn
after the
callbackFlow
builder But also next time just spend 1 minute on google
m
I'll try
stateIn
. Thanks. I spent much more than 1 minute on Google. Sometimes, as you should know, when you don't know the right keywords, because you are very new to a subject, you may find hard to find an answer.
"Welcome to Kotlin Slack . Be Kind. Be Considerate."
I was also using
coroutines
1.3.8, so I could not find it by browsing the sources.
n
tbf.. i would find it hard to even know the right keywords for what to look for on such a specific question.. even a hour of googling would sometimes not help
m
The world is bigger than what you see at this point of your personal evolution, Florian. Have a nice day.
🙄 1