1

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

1 Answers1

1

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};