I want share a pdf file from flutter, directly to whatsapp and telegram in ios and android
Note 1: Flutter share_plus package can't do this, I want directly share to whatsapp and telegram without device native appchooser dialog for share.
Note 2: I don't want use universal links, because I can't sent file with this method, universal links only supports text.
Is there any package for this purpose? If there isn't, How can I write native code for this in ios and android?
Use this plugin to share all social media platforms socioal_share
Or if want to use this plugin for whatsapp, use the whatsapp_share: ^1.1.1 plugin
import 'package:whatsapp_share/whatsapp_share.dart';
For text
Future<void> share() async {
await WhatsappShare.share(
text: 'Whatsapp share text',
linkUrl: 'https://flutter.dev/',
phone: '911234567890',
);
}
For Files
Future<void> shareFile() async {
await WhatsappShare.shareFile(
text: 'Whatsapp share text',
phone: '911234567890',
filePath: [_image1.path, _image2.path],
);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.