thumbnailDataWithSize method
Future<Uint8List?>
thumbnailDataWithSize(
- ThumbnailSize size, {
- ThumbnailFormat format = ThumbnailFormat.jpeg,
- int quality = 100,
- PMProgressHandler? progressHandler,
- int frame = 0,
Obtain the thumbnail data with the given width and height of the asset.
Thumbnail data for videos are images, not compressed video.
See also:
- thumbnailData which obtain the thumbnail data with fixed size.
- thumbnailDataWithOption which accepts customized ThumbnailOption.
Implementation
Future<typed_data.Uint8List?> thumbnailDataWithSize(
ThumbnailSize size, {
ThumbnailFormat format = ThumbnailFormat.jpeg,
int quality = 100,
PMProgressHandler? progressHandler,
int frame = 0,
}) {
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();
}
final ThumbnailOption option;
if (Platform.isIOS || Platform.isMacOS) {
option = ThumbnailOption.ios(
size: size,
format: format,
quality: quality,
);
} else {
option = ThumbnailOption(
size: size,
format: format,
quality: quality,
frame: frame,
);
}
assert(() {
option.checkAssertions();
return true;
}());
return thumbnailDataWithOption(option, progressHandler: progressHandler);
}