I'm using a POST request (with a json body) to retrieve a png image (a qr code). How could I display such image? I checked with image.network but it seems it only handles GET request.
2 Answers
If your response body are png image bytes, then you can try using Image.memory constructor as follows
Image img = Image.memory(response.bodyBytes).image;
You should check out Image.memory and also MemoryImage
Comments
You could use a FutureBuilder for that - the http.post returns a Future<Response> which you need to decode to get to your image url from the response body. (Pass the http.post call to a decoding function returning a Future<String> which is your final image url).
As soon as the Future is resolved you can then build the Image using Image.network
Also have a look at this: How do I update a placeholder image with an async image? as it seems to be related.