getThumbnail method
Future<String?>
getThumbnail({
- required String uriOrPath,
- int width = 256,
- int? height,
- int dateModified = 0,
- String kind = 'image',
override
Generates (or returns a cached) thumbnail for any media file.
Returns the absolute path to the cached JPEG on disk, or null
on failure. Callers should use Image.file(File(path)) to display it.
uriOrPath – content:// URI (Android) or absolute file path.
width – thumbnail width in logical pixels (default 256).
height – thumbnail height in logical pixels (default = width).
dateModified – epoch-ms stamp used for cache invalidation.
kind – "image" | "video" | "audio".
Implementation
@override
Future<String?> getThumbnail({
required String uriOrPath,
int width = 256,
int? height,
int dateModified = 0,
String kind = 'image',
}) async {
final result = await methodChannel.invokeMethod<String>('getThumbnail', {
'uri': uriOrPath,
'width': width,
'height': height ?? width,
'dateModified': dateModified,
'kind': kind,
});
return result;
}