Jonathan
09/24/2024, 5:11 PMselect<T> { ... }
using two Flow
? I would like to choose between which ever returns a response first. One flow is a stream of data and the other is a StateFlow indicating the current connection state. If the connection state flow is != CONNECTED
I’d like my return an error, but if I get the data before the connection state is no longer CONNECTED
, I’d like to return the data.Sam
09/24/2024, 5:15 PMproduce
them and then select between the resulting channelsJonathan
09/24/2024, 5:18 PMproduce
. Thank you for the suggestion.Sam
09/24/2024, 5:19 PMproduceIn
, let me find the docsSam
09/24/2024, 5:19 PMZach Klippenstein (he/him) [MOD]
09/24/2024, 5:20 PMSam
09/24/2024, 5:20 PMJonathan
09/24/2024, 5:21 PMZach Klippenstein (he/him) [MOD]
09/24/2024, 5:24 PMamb
. Jonathan
09/24/2024, 5:35 PMproduceIn
?Zach Klippenstein (he/him) [MOD]
09/24/2024, 5:42 PMJonathan
09/24/2024, 5:44 PMZach Klippenstein (he/him) [MOD]
09/24/2024, 5:48 PMamb
in flow (often renamed to something like "race", which makes much more sense). If you want to factor out your business logic a bit from the flow wiring you could do that.