We can able to send a text message directly to specific contact, but I want to send a file to whatsapp contact using url launcher. How to achieve this in flutter.
Below is my code for sending only message.
String message = "sample text";
String androidURL = "https://wa.me/917390123456/?text=${Uri.parse(message)}";
if(await canLaunchUrl(Uri.parse(URL))){
await launchUrl(Uri.parse(URL),mode: LaunchMode.externalApplication);
}
This is working fine for sending text message. How to send a file by using the same. Can someone help.
2
Answers
To send a file, you can use the
whatsapp://send?file=<file_url>"
URL scheme. To send an image, you can use "whatsapp://send?text=&file=<file_url>" and the file format should be in jpeg or png format.check here. Share images or files
_image1.path contains path of the file which is shared to the whatsapp. check here whatsapp_share
}