1

I used this code to redirect to whatsapp app, but its only works in debugging mode, when i download my app from play store deosnt work

onTap: () async {
  var whatsappApp = Uri.parse("whatsapp://send?phone=$contactusWhatsapp&text=hello");
  if (await canLaunchUrl(whatsappApp)) {
    await launchUrl(whatsappApp);
  } else {
    ScaffoldMessenger.of(context).showSnackBar(
      const SnackBar(
        content: Text("WhatsApp is not installed on the device"),
      ),
    );
  }
},

1 Answers1

0

You can use as below

 onPressed: () async {
                            await launch(
                              "https://wa.me/you write the number here",
                              forceSafariVC: false,
                              forceWebView: false,
                              headers: <String, String>{
                                'my_header_key': 'my_header_value'
                              },
                            );
                          },

To use it this way, you also need to install the url launcher package.

Abdulkadir
  • 56
  • 4