Closed lastant closed 5 years ago
Can you give a more detailed description? Full disclosure: it has been a long time since I have worked with flutter.
It sounds like you are trying to something like
EpubBook epubRef = await EpubReader.readBook(bytes);
Image img = Image.memory(epubRef.CoverImage.getBytes());
Is that correct?
No, the CoverImage has class Image from the dart image package, and its getBytes() method does return a Uint8List.
I want to display images from the content: epubRef.Content.Images[imgHref].readContent()
, and this function returns List<int>
The current workaround for me is to use Uint8List.fromList()
, but it apparently copies the original array and might be slow for big images.
I recommend looking at the example in the examples/flutter_ex
folder. This shows how to get the image rendered in a Flutter application
With an older version of flutter 0.5.1 and epub 1.3.2 I could load an image in a the Image widget with
EpubByteContentFileRef.readContent()
andImage.memory(...)
. But with the latest flutter dev version 0.5.8 and epub 2.0.2 there is an exception:type 'List<int>' is not a subtype of type 'Uint8List'