editArtwork method

Future<bool> editArtwork(
  1. String data,
  2. {bool? openFilePicker,
  3. String? imagePath,
  4. ArtworkFormat? format,
  5. int? size,
  6. String? description,
  7. bool? searchInsideFolders}
)

Used to edit audio artwork.

Parameters:

  • data is used to find multiples audios data.
  • openFilePicker is used to define if folder picker will be open to user choose image.
  • imagePath is used to define image path, only necessary if openFilePicker is false.
  • format is used to define image type: PNG or JPEG.
  • size is used to define image quality.
  • description is used to define artwork description.
  • searchInsideFolders is used for find specific audio data inside the folders. (Only required when using Android 10 or above)

Important:

  • This method will always return a bool.
  • If return true edit works, else edit found a problem.
  • If openFilePicker is null, will be set to true.
  • If imagePath is null, openFilePicker need to be true.
  • If format is null, will be set to JPEG.
  • If size is null, will be set to 24.
  • If description is null, will be set to "artwork".

Implementation

Future<bool> editArtwork(
  String data, {
  bool? openFilePicker,
  String? imagePath,
  ArtworkFormat? format,
  int? size,
  String? description,
  bool? searchInsideFolders,
}) async {
  assert(
      openFilePicker == false || imagePath == null,
      "Cannot change artwork image without image.\n"
      "Set [openFilePicker] to true or give [imagePath] a correct path");
  final bool resultEditArt = await _channel.invokeMethod("editArtwork", {
    "data": data,
    "type": format != null ? format.index : ArtworkFormat.JPEG.index,
    "size": size ?? 24,
    "description": description ?? "artwork",
    "openFilePicker": openFilePicker ?? true,
    "imagePath": imagePath,
    "searchInsideFolders": searchInsideFolders ?? false,
  });
  return resultEditArt;
}