在Flutter中将字节数组转换为图像?

问题描述:

我想从我的REST API服务中获取图像,但是还没有找到任何有关如何解码响应主体(在Flutter中是图像的字节数组)的文档?有一些有用资源的人,请帮助...

I want to get a image from my REST API service however haven't found any documentation on how to decode the response body that would be a byte array to an image in Flutter? Anyone with some useful resources, please help...

将其用于图像小部件:Image.memory(bytes).您可以在此处找到更多文档: https://docs.flutter.io/flutter/widgets/Image/Image.memory.html

Use this for your image widget: Image.memory(bytes) . You can find more documentation here: https://docs.flutter.io/flutter/widgets/Image/Image.memory.html