EpubReader class

A class that provides the primary interface to read Epub files.

To open an Epub and load all data at once use the readBook() method.

To open an Epub and load only basic metadata use the openBook() method. This is a good option to quickly load text-based metadata, while leaving the heavier lifting of loading images and main content for subsequent operations.


// Read the basic metadata.
EpubBookRef epub = await EpubReader.openBook(epubFileBytes);
// Extract values of interest.
String title = epub.Title;
String author = epub.Author;
var metadata = epub.Schema.Package.Metadata;
String genres = metadata.Subjects.join(', ');




hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.

Static Methods

openBook(FutureOr<List<int>> bytes) Future<EpubBookRef>
Loads basics metadata.
readBook(FutureOr<List<int>> bytes) Future<EpubBook>
Opens the book asynchronously and reads all of its content into the memory. Does not hold the handle to the EPUB file.
readByteContentFile(EpubContentFileRef contentFileRef) Future<EpubByteContentFile>
readByteContentFiles(Map<String, EpubByteContentFileRef> byteContentFileRefs) Future<Map<String, EpubByteContentFile>>
readChapters(List<EpubChapterRef> chapterRefs) Future<List<EpubChapter>>
readContent(EpubContentRef contentRef) Future<EpubContent>
readTextContentFiles(Map<String, EpubTextContentFileRef> textContentFileRefs) Future<Map<String, EpubTextContentFile>>