-1

This is the method that i want to use to connect my whatsapp,

 void launchWhatsapp(@required number, @required message) async {
        String url = "whatsapp://send?phone=$number&text=$message";
        await canLaunchUrl(url) ? launch(url) : print("Can not open whatsapp");//The argument type 'String' can't be assigned to the parameter type 'Uri'.
      }

1 Answers1

0

Simply do the following

Uri uri;
String stringUri='whatsapp://send?phone=yournumber&text=yourmessage';
uri = Uri.parse(stringUri);

Use this uri in the place of string url.

Dinesh Falwadiya
  • 769
  • 5
  • 20