Android Kotlin retrigger retrofit api call which return Flow
I'm wrapping and callback base api call using callbackFlow
i Have my repository function which return Flow
repository.kt
fun getItem: Flow = callbackFlow {
api.send(
param,
OnLoadDataCompleted {
override fun onFinish(resultStr: String) {
trySend(it)
}
}
)
}
I'm able to collect the above flow in my UI
viewmodel.getItem.onEach {
updateUI(it)
}
.flowOn(
Dispatchers.IO)
.launchIn(viewmodelScope)
Question is how can I call...