requestThumbnail static method
Requests a thumbnail with width
, height
and quality
for a given identifier
.
This method is used by the asset class, you should not invoke it manually. For more info refer to Asset class docs.
The actual image data is sent via BinaryChannel.
Implementation
static Future<bool?> requestThumbnail(
String? identifier, int width, int height, int quality) async {
if (width < 0) {
throw new ArgumentError.value(width, 'width cannot be negative');
}
if (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');
}
try {
bool? ret = await _channel.invokeMethod(
"requestThumbnail", <String, dynamic>{
"identifier": identifier,
"width": width,
"height": height,
"quality": quality
});
return ret;
} on PlatformException catch (e) {
switch (e.code) {
case "ASSET_DOES_NOT_EXIST":
throw AssetNotFoundException(e.message!);
case "PERMISSION_DENIED":
throw PermissionDeniedException(e.message!);
case "PERMISSION_PERMANENTLY_DENIED":
throw PermissionPermanentlyDeniedExeption(e.message!);
default:
throw e;
}
}
}