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.

Example

// 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(', ');

Constructors

EpubReader()

Properties

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

Methods

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

Operators

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

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>>