Do we have any solution to convert an api response to ArrayBuffer?
154
You can get buffer data from something like that :
var response = await Dio().get(
"https://www.google.com/pdf/$pdfId",
options: Options(
responseType: ResponseType.bytes,
contentType: 'application/octet-stream',
),
);
var data = {"data": response.data.buffer};
Author by
Hưng Nguyễn Trần Gia
Updated on December 14, 2022Comments
-
Hưng Nguyễn Trần Gia over 1 year
I have recently reached a situation where I download an image from REST API and got the result like this in this thread: Weird characters in image response of POST request.
Basically, my response will look like this https://i.stack.imgur.com/FoxKR.png
Is there any solution to convert an api response to ArrayBuffer like in web stack?
Thank you