0

My phone call method is not working. When I give my mobile number directly its working. However when I pass from my DB it's not working... It's always dialing 662453...
Here is my code :

void _launchCaller(String mobile) async {
    //debugPrint(mobile);
    //UrlLauncher.launch('tel:${contact.phone}');
    const url = "tel:mobile";
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }
cocool97
  • 1,201
  • 1
  • 10
  • 22
raj
  • 311
  • 1
  • 9
  • 19
  • you can check this answer [https://stackoverflow.com/questions/45523370/making-phone-call-from-a-flutter-app](https://stackoverflow.com/questions/45523370/making-phone-call-from-a-flutter-app) – Hairon Chaviano Nov 20 '19 at 16:03

1 Answers1

3

Is that a syntax error? "tel:mobile" will not work, "tel:$mobile" will.

Also 662453 is how the "mobile" word appear on the keyboard of the phone. (look the letters under every number)

Cristian Bregant
  • 1,797
  • 1
  • 16
  • 22