readChapters static method

Future<List<EpubChapter>> readChapters(
  1. List<EpubChapterRef> chapterRefs
)

Implementation

static Future<List<EpubChapter>> readChapters(
    List<EpubChapterRef> chapterRefs) async {
  var result = <EpubChapter>[];
  await Future.forEach(chapterRefs, (EpubChapterRef chapterRef) async {
    var chapter = EpubChapter();

    chapter.Title = chapterRef.Title;
    chapter.ContentFileName = chapterRef.ContentFileName;
    chapter.Anchor = chapterRef.Anchor;
    chapter.HtmlContent = await chapterRef.readHtmlContent();
    chapter.SubChapters = await readChapters(chapterRef.SubChapters!);

    result.add(chapter);
  });
  return result;
}