readChapters static method

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

Implementation

static Future<List<EpubChapter>> readChapters(
    List<EpubChapterRef> chapterRefs) async {
  final result = <EpubChapter>[];
  await Future.forEach(chapterRefs, (EpubChapterRef chapterRef) async {
    final chapter = EpubChapter(
      chapterRef.title,
      chapterRef.contentFileName,
      chapterRef.anchor,
      await chapterRef.readHtmlContent(),
      await readChapters(chapterRef.subChapters),
    );

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