How to get response body with request.send() in dart

I checked the docs for request.send I returns Future<StreamedResponse> instead of Future<Response>

Digging more for StreamedResponse I found that it which is a ByteStream

Here is what you can do to get response in String

final response = await request.send();
final respStr = await;

In my opinoin you should only use request.send if you want streamed response instead of “collected” response. More about streams in dart here

Leave a Comment