resolveKey method

Future<CPDFPageThumbnailKey> resolveKey({
  1. required CPDFPageThumbnailSource source,
  2. required int pageIndex,
  3. required CPDFPageThumbnailOptions options,
})

Resolves an immutable provider key.

Implementation

Future<CPDFPageThumbnailKey> resolveKey({
  required CPDFPageThumbnailSource source,
  required int pageIndex,
  required CPDFPageThumbnailOptions options,
}) async {
  if (pageIndex < 0) {
    throw ArgumentError.value(
        pageIndex, 'pageIndex', 'Must not be negative.');
  }
  options.validate();
  final pageMetrics = await _renderer.getPageMetrics(source, pageIndex);
  final thumbnailSize = options.resolveSize(pageMetrics.size);
  final key = CPDFPageThumbnailKey(
    source: source,
    sourceScope: await source.resolveScope(),
    pageIndex: pageIndex,
    width: thumbnailSize.width,
    height: thumbnailSize.height,
    rotation: _normalizeRotation(pageMetrics.rotation),
    options: options,
  );
  return key;
}