https://kotlinlang.org logo
Title
s

Slackbot

04/04/2022, 3:01 PM
This message was deleted.
j

Joffrey

04/04/2022, 3:01 PM
Do you have a
Flow
or a
StateFlow
? If a plain
Flow
, what do you mean by "its value"?
t

the great warrior

04/04/2022, 3:02 PM
it is a flow
I mean if it is true or false
j

Joffrey

04/04/2022, 3:04 PM
A
Flow
is a stream of values, so if you have a
Flow<Boolean>
it's not obvious which boolean value you're talking about. Do you mean the first emitted value upon collection?
t

the great warrior

04/04/2022, 3:05 PM
yes
j

Joffrey

04/04/2022, 3:07 PM
I guess the comments and answers on the SO question summarize what I wanted to say pretty well already
t

the great warrior

04/04/2022, 3:08 PM
thanks Joffrey Bion I really I appreciate your help
🤔 1
j

Joffrey

04/04/2022, 3:08 PM
What is your
Flow
backed by? How are values produced? This might help me understand why it makes sense for you to talk about "the value" of the flow
If you want the first value, you could always do
runBlocking { flow.first() }
but it's almost certainly wrong to do so, hence why I'm trying to grasp your particular use case better
👍 1
thanks Joffrey Bion I really I appreciate your help
Is that sincere or passive-aggressive?
t

the great warrior

04/04/2022, 3:17 PM
of course that is sincere, you already answered my question (runBlocking { flow.first() })
j

Joffrey

04/04/2022, 3:32 PM
Ok, that message was before, though. Hence my question
Note that I told you this solution was very likely a wrong solution. Most likely using a
StateFlow
instead would be more appropriate if you want to access a "current value" but also have observability.