positionsByReadingOrder method

  1. @override
Future<List<List<Locator>>> positionsByReadingOrder()
override

Returns the list of all the positions in the publication, grouped by the resource reading order index.

Implementation

@override
Future<List<List<Locator>>> positionsByReadingOrder() async {
  int pageCount = readingOrder.length;
  return readingOrder
      .mapIndexed((index, link) => [
            Locator(
                href: link.href,
                type: link.type ?? fallbackMediaType,
                title: link.title,
                locations: Locations(
                    position: index + 1,
                    totalProgression:
                        index.toDouble() / pageCount.toDouble()))
          ])
      .toList();
}