Closed huangcs427 closed 1 year ago
My code is as follows
Future<String> createCoverPath({ required int id, required String fileName, int quality = 100, ArtworkType type = ArtworkType.AUDIO, ArtworkFormat format = ArtworkFormat.PNG, }) async { try { Directory tempPath = await getTemporaryDirectory(); final coverPath = getCoverPath(tempPath, fileName); final File file = File(coverPath); if (!await file.exists()) { await file.create(); final Uint8List? image = await audioQuery.queryArtwork( id, type, format: format, size: coverSize, quality: quality, ); file.writeAsBytesSync(image!); } return file.path; } catch (e) { print("$fileName => get cover error: $e"); return ''; } }
My code is as follows