thumbnailDataWithOption method

Future<Uint8List?> thumbnailDataWithOption(
  1. ThumbnailOption option, {
  2. PMProgressHandler? progressHandler,
  3. PMCancelToken? cancelToken,
})

Obtain the thumbnail data with the given customized ThumbnailOption.

See also:

  • thumbnailData which obtain the thumbnail data with fixed size.
  • thumbnailDataWithSize which is a common method to obtain thumbnails.
  • cancelToken is used to cancel the thumbnail loading process.

Implementation

Future<typed_data.Uint8List?> thumbnailDataWithOption(
  ThumbnailOption option, {
  PMProgressHandler? progressHandler,
  PMCancelToken? cancelToken,
}) {
  assert(() {
    _checkThumbnailAssertion();
    return true;
  }());
  // Return null if the asset is audio or others.
  if (type == AssetType.audio || type == AssetType.other) {
    return Future<typed_data.Uint8List?>.value();
  }
  assert(() {
    option.checkAssertions();
    return true;
  }());
  return plugin.getThumbnail(
    id: id,
    option: option,
    progressHandler: progressHandler,
    cancelToken: cancelToken,
  );
}