Proposed fix for sending sending heic and heif file messages

Currently, file messages containing files with types not found in the mime library using lookupMimeType(file) are not sent. This includes both HEIC and HEIF file types, the default on many IOS devices. This could be fixed by checking header bytes for file types which can be done with the mime library.
in file file_message_params.dart:

  FileMessageParams.withFile(File file, {String? name})
      : uploadFile = FileInfo.fromData(
          name: name ?? 'my_file',
          file: file,
          mimeType: lookupMimeType(file.path),
        );

could be changed to

  FileMessageParams.withFile(File file, {String? name})
      : uploadFile = FileInfo.fromData(
          name: name ?? 'my_file',
          file: file,
          mimeType: lookupMimeType(file.path, headerBytes: [0xFF, 0xD8]),
        );

It might be helpful to refactor to force mimeType to be a non-null member so it throws when a file that can’t send is passed in. The current behavior is onComplete is never called. So it appears as if it is trying to send indefinitely.

Hi @Logan_Parker,

I understand the pain point. Let me connect with our Flutter Engineers and see what we can do to make this a bit more robust.

Hi @Logan_Parker,

Our Engineering team is hoping to release a fix by the end of the week for this. I’ll update you once I see the change go out.