在Flutter中将Blob显示为图像 [英] Display Blob as Image in Flutter
本文介绍了在Flutter中将Blob显示为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道如何使用Flutter将Blob转换为图像吗?看起来'dart:html'
库在Flutter中不可用.任何帮助表示赞赏.谢谢!
Does anyone know how to convert a Blob into an image with Flutter? It looks like the 'dart:html'
library is not available in Flutter. Any help is appreciated. Thank you!
推荐答案
如果有人感兴趣,我找到了解决方法:
If anyone is interested, I found the solution:
从JSON中获取斑点:
Grab the blob from JSON:
var blob = yourJSONMapHere['yourJSONKeyHere'];
var image = BASE64.decode(blob);
//图片是一个Uint8List
var image = BASE64.decode(blob);
// image is a Uint8List
现在,在Image.memory
new Container( child: new Image.memory(image));
这对我有用!
这篇关于在Flutter中将Blob显示为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文