Shashank
10/02/2020, 11:21 AMStateFlow
? If I have a data class
data class ProfileState(val isLoading: Boolean, val userName: String?)
and I have the following states which are being emitted
1. ProfileState(true, null)
2. ProfileState(false, “John Doe”)
So how do I that I received the states in the correct order while accounting for the conflation which is done by StateFlow
?Javier
10/02/2020, 11:24 AMShashank
10/02/2020, 11:30 AMStateFlow
taer
10/02/2020, 3:04 PMflow.onStart
that unlocks a pre-locked semaphore. Then I had code that was trying to lock the semaphore. So when the flow test code starts consuming, I know the event capturing is happening. Then I think you could update the MutableState. I didn't use these libs though, I just called flow.toList() in a async job and made my assertions on them.taer
10/02/2020, 3:08 PMtaer
10/02/2020, 3:08 PMShashank
10/02/2020, 3:08 PMtaer
10/02/2020, 3:09 PMflow.test(this) {
assertValues(ProfileState(true, null))
doTheThingThatChangesTheState()
assertValues(ProfileState(false, "John Doe"))
}
taer
10/02/2020, 3:10 PMtaer
10/02/2020, 3:14 PM