mimeTypeEnum property

MimeType? get mimeTypeEnum

Returns the MimeType enum value for this artwork's MIME type.

This is a convenience method that converts the string-based mimeType to the corresponding MimeType enum value. Returns null if the MIME type is not recognized or supported by the enum.

This method is useful for:

  • Type-safe MIME type checking
  • Accessing MIME type properties (transparency, compression, etc.)
  • Format-specific processing logic
  • Validation and compatibility checking

Example:

final artwork = ArtworkData(
  mimeType: 'image/jpeg',
  type: ArtworkType.frontCover,
  dataLoader: () async => imageBytes,
);

final mimeTypeEnum = artwork.mimeTypeEnum;
if (mimeTypeEnum != null) {
  print('Supports transparency: ${mimeTypeEnum.supportsTransparency}');
  print('Is lossy: ${mimeTypeEnum.isLossy}');
  print('File extension: ${mimeTypeEnum.fileExtension}');
}

Implementation

MimeType? get mimeTypeEnum => MimeType.fromName(mimeType);