ArtworkData.immediate constructor
const
ArtworkData.immediate({
- required String mimeType,
- required ArtworkType type,
- String? description,
- required Uint8List data,
Creates a new ArtworkData instance with immediately available data.
This constructor is used during encoding operations where image data has been pre-loaded and needs to be written synchronously to the container. This approach maintains memory efficiency by only loading data for files that are actually being encoded.
@param mimeType The MIME type of the image (e.g., 'image/jpeg') @param type The classification of this artwork image @param description Optional human-readable description @param data The actual image bytes, already loaded into memory
Example:
final imageBytes = await loadImageFromFile('cover.jpg');
final artworkData = ArtworkData.immediate(
mimeType: 'image/jpeg',
type: ArtworkType.frontCover,
description: 'Album cover art',
data: imageBytes,
);
Implementation
const ArtworkData.immediate({
required this.mimeType,
required this.type,
this.description,
required Uint8List data,
}) : _immediateData = data,
_dataLoader = null;