Tymmm1
12/13/2020, 9:25 PMcollect just once from a StateFlow or SharedFlow ? One can call cancel() on the job of the coroutine that is collecting but that seems a bit cumbersome...Tijl
12/13/2020, 9:45 PMfirst()Tymmm1
12/13/2020, 10:02 PMfirst() unfortunately has different behavior from collect() in that it throws an exception when the flow is empty.travis
12/13/2020, 10:02 PMfirstOrNullTymmm1
12/13/2020, 10:03 PMfirstOrNull also has different behavior. It returns null if the flow is empty where collect would just block and wait until there is something.Tijl
12/13/2020, 10:05 PMTijl
12/13/2020, 10:07 PMTymmm1
12/13/2020, 10:08 PMfirst() when I was using it on a SharedFlow (with no initial value).Tymmm1
12/13/2020, 10:09 PMcollect() on a SharedFlow no exception is thrown.Tymmm1
12/13/2020, 10:10 PMTijl
12/13/2020, 10:11 PMTijl
12/13/2020, 10:18 PMvalue since reading that code it will be more clear it will not suspend ( first behaves the same in this case but on other Flows like SharedFlow it can suspend)Tymmm1
12/13/2020, 10:19 PM