isSupportedFile static method
Checks if the given filename corresponds to a supported file type.
Parameters:
filename
: The name of the file to check.
Returns:
- A boolean indicating whether the file is a supported file type.
Implementation
static bool isSupportedFile(String filename) {
// Define supported file extensions
const supportedExtensions = [
"jpg", "jpeg", "png", "gif", "bmp", "webp", // Image files
"doc", "docx", "xls", "xlsx", "ppt", "pptx", // Office files
"pdf", // PDF files
"zip", // Zip files
"txt" // Text files
];
// Get the file extension
final fileExtension = filename.split(".").last.toLowerCase();
// Check if the file extension is in the list of supported extensions
return supportedExtensions.contains(fileExtension);
}