How to determine if the FileMessage is an Image or a file?

I’m using sendbird flutter package (sendbird_sdk | Flutter Package) and It’s giving me a hard time to determine if Im going to display an image or a file from FileMessage. any suggestions or logic for this one? Thank you :smiley:


@Arone_Jerome Try using the ‘type’ key which is coming in BaseMessage object to check the extension of file. May be it will help in solving your issue.

@Arone_Jerome Have you tried sending pdf or doc file using flutter chat sdk? I am able to send the images but not able to send pdf or doc files. If you have worked on this kindly help me out.

2 Likes

Yeah, I did use already the type parameter. and validating if its an image or not. It’s working But suddenly I did also try to send file with .json extension. but the type paremeter is empty.

@Arone_Jerome Can you confirm are you able to send pdf , doc or xls file from flutter chat sdk as I am getting issue in sending these type of files

Hello @Akhil_Gupta . yes, I’m able to send pdf, doc or xls without any problems. I did use file_picker | Flutter Package package for selecting a file. Check my sample code on the image I provided.
Screen Shot 2022-08-22 at 10.21.21 AM

1 Like

You can add customType on messages to detemine if the FileMessage is a file or not.