In my ViewModel
I have to call a repository function that exposes a callbackFlow
.
Normally I would have the suspend function in repo classes wrap their code block in a
withContext(Dispatcher.IO) { }
block.
Or if I want to make a Flow main-safe I could also use the .flowOn()
operator, but that api isn't available with callbackFlows.
So my question is 'how do I make the use of callbackFlows main-safe?'... assuming they aren't out of the box.
flowOn
isn't available with callbackFlows"? – IR42flowOn
is certainly available with callbackFlow – tyczj