isImage property

bool get isImage

Whether this attachment holds displayable image content.

True for ImageFileAttachments and for LinkAttachments whose supplied or inferred MIME type is an image/ type; false for ordinary files and links.

Implementation

bool get isImage => switch (this) {
  ImageFileAttachment() => true,
  FileAttachment() => false,
  LinkAttachment(:final mimeType) => Attachment._isImage(mimeType),
};