isImage static method

Future<bool> isImage(
  1. MergeInput input
)

Determines whether the given file path/blob corresponds to an image file.

Implementation

static Future<bool> isImage(MergeInput input) async {
  late FileMagicNumberType fileType;
  switch (input.type) {
    case MergeInputType.path:
      fileType =
          await FileMagicNumber.detectFileTypeFromPathOrBlob(input.path!);
      break;
    case MergeInputType.bytes:
      fileType = FileMagicNumber.detectFileTypeFromBytes(input.bytes!);
      break;
  }
  return fileType == FileMagicNumberType.png ||
      fileType == FileMagicNumberType.jpg ||
      fileType == FileMagicNumberType.heic;
}