isImage property
bool
get
isImage
Returns true when the file appears to be an image file.
Detection is based on MIME type and common filename extensions.
Example:
if (file.isImage) {
print('Generate a thumbnail');
}
Implementation
bool get isImage {
final mime = contentType.toLowerCase();
return mime.startsWith('image/') || ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.svg'].any((ext) => filename.toLowerCase().endsWith(ext));
}