2

如何在Flutter web中启动 WhatsApp 或在 Flutter 中从浏览器启动 WhatsApp或从 pub.dev 建议任何包?

4

2 回答 2

2

你可以给一个带href的锚点https://api.whatsapp.com/send/?phone=(phone_number)

完整代码

<a href="https://api.whatsapp.com/send/?phone=6281144441111&text=Hello">Send Hi to me</a>

注意:
确保您提供的国家/地区代码不带 (+)。
例如 6281144441111

于 2020-11-25T15:28:42.940 回答
0

您需要 url_launcher https://pub.dev/packages/url_launcher。在你的 yaml 中导入包,然后在你的 .dart 中

然后使用带有 WhatsApp URL 的启动功能:launch('whatsapp://send?phone=$phonenumber')

为了启动 WhatsApp 网站,请使用launch('https://web.whatsapp.com')

于 2020-11-25T15:30:16.653 回答