isSupportedFile static method
Checks if the given filename corresponds to a supported file type.
Supported file types include:
- Image files: jpg, jpeg, png, gif, bmp, webp
- Office files: doc, docx, xls, xlsx, ppt, pptx
- Video files: mp4, mov, avi, mkv, flv, wmv, webm
- PDF files: pdf
- Archive files: zip
- Text files: txt
Parameters:
filename: The filename to check
Returns true if the file type is supported, false otherwise.
Implementation
static bool isSupportedFile(String filename) {
const supportedExtensions = [
'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', // Image files
'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', // Office files
'mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', 'webm', // Video files
'pdf', // PDF files
'zip', // Zip files
'txt' // Text files
];
return _hasExtension(filename, supportedExtensions);
}