queryArtworks method
Future<Uint8List?>
queryArtworks(
- int id,
- ArtworkType type, [
- ArtworkFormat? format,
- int? size,
- bool? requestPermission,
Used to return Songs Artwork.
Parameters:
requestPermission
is used for request or no Android STORAGE PERMISSION.type
is used to define if artwork is from audios or albums.format
is used to define typePNG
orJPEG
.size
is used to define image quality.
Usage and Performance:
- Using
PNG
will return a better image quality but a slow performance. - Using Size greater than 200 probably won't make difference in quality but will cause a slow performance.
Important:
- This method is only necessary for API >= 29
Android Q/10
. - If queryArtworks is called in Android below Q/10, will return null.
- If
requestPermission
is null, will be set tofalse
. - If
format
is null, will be set toJPEG
for better performance. - If
size
is null, will be set to200
for better performance - We need this method separated from
querySongs/queryAudios
because returnUint8List
and using inside query causes a slow performance.
Implementation
Future<Uint8List?> queryArtworks(
int id,
ArtworkType type, [
ArtworkFormat? format,
int? size,
bool? requestPermission,
]) async {
final Uint8List? finalArtworks =
await _channel.invokeMethod("queryArtworks", {
"requestPermission": _checkPermission(requestPermission),
"type": type.index,
"id": id,
"format": format != null ? format.index : ArtworkFormat.JPEG.index,
"size": size != null ? size : 200
});
return finalArtworks;
}