我必须将我的颤振应用程序中的图像直接发送到 whatsapp。启动whatsapp后,我想选择要分享图像的联系人。这在颤振中怎么可能?
我尝试使用 url_launcher,但它正在启动指定的联系人。而且我在任何地方都找不到共享选项。
const url = 'whatsapp://send?phone=$phone';
if (await URLLauncher.canLaunch(url)) {
await URLLauncher.launch(url);
}
else {
throw 'Could not launch $url';
}
Run Code Online (Sandbox Code Playgroud)
您可以使用esys_flutter_share在 flutter 中共享文件。您只需要将文件作为字节发送并共享到您想要的任何外部应用程序。
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.');
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9274 次 |
最近记录: |