I have to send an image from my flutter application to whatsapp directly. After launching the whatsapp, I want to select the contacts to share the image. How this possible in flutter?
I tried using url_launcher, but it is launching the specified contact. And I couldn't find the sharing option anywhere.
const url = 'whatsapp://send?phone=$phone';
if (await URLLauncher.canLaunch(url)) {
await URLLauncher.launch(url);
}
else {
throw 'Could not launch $url';
}
You can make use of esys_flutter_share to share files in flutter. You just need to send a file as bytes and share to any external application you want.
final ByteData bytes = await rootBundle.load('assets/image1.png');
await Share.file('esys image', 'esys.png', bytes.buffer.asUint8List(), 'image/png', text: 'My optional text.');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With