requestThumbnail method
Implementation
@override
Future<bool> requestThumbnail(
String identifier,
int width,
int height,
int quality,
) async {
if (width < 0) {
throw ArgumentError.value(width, 'width cannot be negative');
}
if (height < 0) {
throw ArgumentError.value(height, 'height cannot be negative');
}
if (quality > 100) {
throw ArgumentError.value(quality, 'quality should be in range 0-100');
}
try {
final bool ret = await methodChannel.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 ?? 'ASSET_DOES_NOT_EXIST');
case "PERMISSION_DENIED":
throw PermissionDeniedException(e.message ?? 'PERMISSION_DENIED');
case "PERMISSION_PERMANENTLY_DENIED":
throw PermissionPermanentlyDeniedExeption(
e.message ?? 'PERMISSION_PERMANENTLY_DENIED');
default:
rethrow;
}
}
}