queryArtwork method

Future<Uint8List?> queryArtwork(
  1. int id,
  2. ArtworkType type, {
  3. ArtworkFormat? format,
  4. int? size,
  5. int? quality,
})

Used to return Songs Artwork.

Parameters:

  • type is used to define if artwork is from audios or albums.
  • format is used to define type PNG or JPEG.
  • 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 queryArtwork is called in Android below Q/10, will return null.
  • If format is null, will be set to JPEG for better performance.
  • If size is null, will be set to 200 for better performance
  • We need this method separated from querySongs/queryAudios because return Uint8List and using inside query causes a slow performance.

Platforms:

Android IOS Web
✔️ ✔️ ✔️

See more about platforms support

Implementation

Future<Uint8List?> queryArtwork(
  int id,
  ArtworkType type, {
  ArtworkFormat? format,
  int? size,
  int? quality,
}) async {
  return platform.queryArtwork(
    id,
    type,
    format: format,
    size: size,
    quality: quality,
  );
}