I’m also very happy with my experience and use of ...
# coroutines
d
I’m also very happy with my experience and use of StateFlow! I use it as a guard when making several requests at once, but the access token has expired and needs to be refreshed. The first request sets the state to “Refreshing” and then make the request to update the token, and subsequent requests will see that the state is Refreshing and use
flow.first { }
to suspend until the state is “Idle” again and then perform the intended request. Works like a charm, and a bonus; it is written in a mpp module and works for both android and ios 🙂
👍 3