readBook static method
Opens the book asynchronously and reads all of its content into the memory. Does not hold the handle to the EPUB file.
Implementation
static Future<EpubBook> readBook(FutureOr<List<int>> bytes) async {
var result = EpubBook();
List<int> loadedBytes;
if (bytes is Future) {
loadedBytes = await bytes;
} else {
loadedBytes = bytes;
}
var epubBookRef = await openBook(loadedBytes);
result.Schema = epubBookRef.Schema;
result.Title = epubBookRef.Title;
result.AuthorList = epubBookRef.AuthorList;
result.Author = epubBookRef.Author;
result.Content = await readContent(epubBookRef.Content!);
result.CoverImage = await epubBookRef.readCoverAsUint8List();
var chapterRefs = await epubBookRef.getChapters();
result.Chapters = await readChapters(chapterRefs);
return result;
}