isImageByPath function

bool isImageByPath(
  1. String path
)

Implementation

bool isImageByPath(String path) {
  String ext = path.split(".").last.toLowerCase();
  switch (ext) {
    case 'jpeg':
    case 'png':
    case 'jpg':
    case 'gif':
    case 'webp':
    case 'bmp':
    case 'ico':
    case 'svg':
    case 'tiff':
    case 'tif':
    case 'heic':
    case 'heif':
    case 'avif':
      return true;
    default:
      return false;
  }
}