2

I have designed a function to call a number on a pressed icon. But it cannot launch url

 _callMe() async {
 print("Phone +91${store_phone}");
 var uri = 'tel:+91${store_phone}';
 if (await canLaunch(uri)) {
   await launch(uri);
 } else {
   throw 'Could not launch $uri';
 }
}

It Prints the error Unhandled Exception: Could not launch +919919195521

any help guys?

Arpit Jai
  • 211
  • 2
  • 14

2 Answers2

0

Try below code hope its help to you. used url_launcher package

Padding(
  padding: EdgeInsets.only(top: 18.0),
  child: InkWell(
    child: Text(
      ' +91 888-888-8888',
      style: TextStyle(
        fontSize: 15,
        color: Colors.blue,
      ),
    ),
    onTap: () => launch('tel:${8888888888}'),
  ),
)
Ravindra S. Patil
  • 11,757
  • 3
  • 13
  • 40
0
 Uri numberUri;
     numberUri = Uri(scheme: 'tel', path: phoneNumber);

    if (!await launchUrl(numberUri)) throw 'Could not launch $numberUri';

Use the above method to open phone dialer

General Grievance
  • 4,555
  • 31
  • 31
  • 45