Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如何在Flatter中显示base64中的pdf?_Image_Pdf_Flutter_Dart - Fatal编程技术网

Image 如何在Flatter中显示base64中的pdf?

Image 如何在Flatter中显示base64中的pdf?,image,pdf,flutter,dart,Image,Pdf,Flutter,Dart,我有base64中的pdf内容,我需要在颤振应用程序的容器中显示它 我正在尝试使用dart的图像、pdf和转换包,但图像类出现错误,我不知道如何显示图像 List<int> pdfDataBytes = base64.decode(fileContent); Image img = decodeImage(pdfDataBytes); PdfImage image = PdfImage( pdf, image: img.data.buffer.asUint8L

我有base64中的pdf内容,我需要在颤振应用程序的容器中显示它

我正在尝试使用dart的图像、pdf和转换包,但图像类出现错误,我不知道如何显示图像

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);
List pdfDataBytes=base64.decode(fileContent);
图像img=解码图像(pdfDataBytes);
PdfImage image=PdfImage(
pdf,
image:img.data.buffer.asUint8List(),
宽度:img.width,
高度:img.高度);

这是image类中的错误消息:尝试对其中一个导入指令使用“as prefix”,或对除一个导入之外的所有导入隐藏名称

我没有测试它,但您有显示pdf:
您可以找到一个将此软件包与pdf资产一起使用的示例。

此错误意味着您有一个重复的图像导入。

谢谢,但文章在一个路径中显示了一个pdf文件,我只有Base64中的内容。您不能将您的内容存储在一个文件中吗?Future _createFileFromString()async{final encodedStr=“将base64编码字符串放在此处”;Uint8List bytes=base64.decode(encodedStr);string dir=(await getApplicationDocumentsDirectory()).path;File File=File(“$dir/”+DateTime.now().millisondssinceepoch.toString()+”.pdf”);await File.writeAsBytes(字节);return File.path;}。该方法从何处获得?”未为类“getApplicationDocumentsDirectory来自包路径\提供程序”定义方法“getApplicationDocumentsDirectory”