I consider why there is no Retrofit2 adapter for Flow type like FlowCallAdapter and FlowCallAdapterFactory?
I found that retrofit supports suspend functions, and http request are one-shot so it better fits to have suspend functions rather then Flow return type, but Flow is more equivalent of RxJava and reactive programming frameworks and better fit in this schema of programming
How I can do something like this withoud Retrofit returning Flow and instead having suspend function
rules
.filter { it.isAsync }
.asFlow()
.flatMapMerge {
val rule = it
rule.validateAsync(input)
.filter { !it }
.map { rule }
}
.scan(mutableListOf<String>()) { acc, rule ->
acc.add(rule.errorMessage)
acc
}
.flowOn(Dispatchers.IO)
If I am using suspend I need to do something like this generally
return flow { emit(service.validate(email = value)) }