Flow is not supported. You should just return Resp...
# squarelibraries
Flow is not supported. You should just return ResponseBody directly in a suspend fun
the how can I listen to the stream?
It’s not a stream then, it’s a single suspending call. Individual network calls were never conceptually streams even with Rx, it just happened that it was convenient to treat them as streams of a single item in order to integrate with the whole RxJava model. Suspend functions are a much better way to model network calls because they're much closer to how the call actually works - you invoke the call (send the request), then wait for the response (suspend), and when the response comes back your program can continue with processing it (suspend cal resumes/returns).
You can easily convert a suspend function into a Flow if you need to treat it as a stream for other reasons. I believe there’s an
extension function on suspend function references, or you can do something like
flow { service.call() }
Yep, suspend {}.asFlow