Reputation: 75
I have the content of a pdf in base64 and I need to show it in a container in a flutter application.
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
Upvotes: 4
Views: 3545
Reputation: 1611
I didn't test it but you have flutter package displaying pdf : flutter full pdf viewer You can find here an example of using this package with a pdf asset.
Upvotes: 1