Hello, I wanted to ask about something I haven't t...
# test
s
Hello, I wanted to ask about something I haven't tried in a while, I used to do the initial call inside viewmodels in the init block and then for testing use pause dispatcher and resume dispatcher to connect the flow to turbine before my init call started while creating the viewmodel. From what I see the pause and resume dispatcher are deprecated, so I wanted to ask what's recommend to do right now. My intention is to see that we get the loading state and then success state with specific data and then nothing else. Thank you in advance.
s
Use stateIn with SharingStarted.WhileSubscribed to create your StateFlow, that way nothing will start running until you actually start collecting it. In your test, that would be only after you call turbine's test function and you start collecting it.
🤔 1
👍 1
s
I'll see if that works with the flow that paging 3 produces