isImage static method

bool isImage(
  1. String filePath
)

Checks if string is an image file.

Implementation

static bool isImage(String filePath) {
  final ext = filePath.toLowerCase();

  return ext.endsWith(".jpg") ||
      ext.endsWith(".jpeg") ||
      ext.endsWith(".png") ||
      ext.endsWith(".gif") ||
      ext.endsWith(".bmp");
}