本文介绍了如何在flutter中的base64中显示pdf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在base64中拥有pdf的内容,我需要在flutter应用程序的容器中显示它.
I have the content of a pdf in base64 and I need to show it in a container in a flutter application.
我正在尝试使用图像,pdf和dart转换包,但是图像类出现错误,并且我不知道如何显示图像.
I'm trying to do it with the image, pdf and convert packages from dart,but I get an error with the image class and I don't know how to show the image.
List<int> pdfDataBytes = base64.decode(fileContent);
Image img = decodeImage(pdfDataBytes);
PdfImage image = PdfImage(
pdf,
image: img.data.buffer.asUint8List(),
width: img.width,
height: img.height);
这是图像类错误的消息:尝试对导入指令之一使用作为前缀",或对除导入之一以外的所有内容隐藏名称
This is the message of the error in the image class: Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports
推荐答案
此错误表示您重复导入了Image.
This error means you have a duplicate import for Image.
这篇关于如何在flutter中的base64中显示pdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!