我正在构建一个flutter网络应用程序,它必须能够在特定的WhatsApp业务号码和WhatsApp号码上发送消息。我到底应该怎么做?如果用户的设备有WhatsApp或WhatsApp业务,他就会打开它。但我的问题是,如果用户的设备同时有WhatsApp和WhatsApp业务,我希望在一个条件下打开一个。
var whatsappURlAndroid = "https://wa.me/$whatsappNumber/?text=Hi";
var whatappURLIos ="https://wa.me/$whatsappNumber?text=${Uri.parse("hello")}";
var webWhatsapp= "https://web.whatsapp.com/send?phone=$whatsappNumber&text=Hello";
if (defaultTargetPlatform == TargetPlatform.iOS) {
await launch(whatappURLIos, forceSafariVC: false);
}else if(defaultTargetPlatform == TargetPlatform.android){
await launch(whatsappURlAndroid);
}
else{
await launch(webWhatsapp);
}
1条答案
按热度按时间r3i60tvu1#
FocusManager.instance.primaryFocus?.unfocus();