hasValidExtension static method

bool hasValidExtension(
  1. String filePath,
  2. List<String> allowedExtensions
)

Check if file path has valid extension

filePath - The file path allowedExtensions - List of allowed extensions Returns true if file has valid extension

Implementation

static bool hasValidExtension(String filePath, List<String> allowedExtensions) {
  final extension = getFileExtension(filePath);
  return allowedExtensions.any((ext) => ext.toLowerCase() == extension.toLowerCase());
}