https://kotlinlang.org logo
#flow
Title
# flow
k

KV

03/04/2024, 1:10 PM
Hi, what is the best way to skip the result from the flow? For example I have 3 states. Loading, Done, Success Loading and Done are always there but when success comes can we hide the Done state from the UI? 1st Scenario: I need to show->loading--------5 seconds ------done 2nd Scenario: I need to show ->loading--------5 seconds(done state should not visible in the UI ) ------ success It means -> loading ... done state skip as we have success Like I want to add the timer for done: if within 5 seconds or 10 seconds success doesn't come, then show the done state?
p

psh

03/04/2024, 1:20 PM
It sounds like you want a 5-second timeout on the loading side of things. Take a look at
withTimeout()
to see if that covers what you need.
k

KV

03/04/2024, 1:39 PM
I want a timeout for Done state. 1. Loading....10 seconds....Done 2. Loading....5 seconds...Success and then skip the Done as I am gettin Success within 5 seconds
2 Views