getAlbumThumbnail static method
Implementation
static Future<ByteData> getAlbumThumbnail({
required String imagePath,
required int? width,
required int? height,
int quality = 100,
}) async {
Completer<ByteData> completer = Completer<ByteData>();
if (width != null && width < 0) {
throw new ArgumentError.value(width, 'width cannot be negative');
}
if (height != null && height < 0) {
throw new ArgumentError.value(height, 'height cannot be negative');
}
if (quality < 0 || quality > 100) {
throw new ArgumentError.value(
quality, 'quality should be in range 0-100');
}
ServicesBinding.instance!.defaultBinaryMessenger.setMessageHandler(
'adv_image_picker/image/fetch/thumbnails/$imagePath',
(ByteData? message) {
ServicesBinding.instance!.defaultBinaryMessenger.setMessageHandler(
'adv_image_picker/image/fetch/thumbnails/$imagePath', null);
completer.complete(message);
return null;
},
);
await _channel.invokeMethod(
"getAlbumThumbnail",
<String, dynamic>{
"imagePath": imagePath,
"width": width,
"height": height,
"quality": quality
},
);
return completer.future;
}