Send sms directly from flutter app on click in adnroid and ios,

Viewed 126

I m trying to send SMS directly from my flutter app but I m not finding good package, I try flutter SMS but its open SMS default app or I also try telephony its send SMS only to android

1 Answers
    Try "**url_launcher**" flutter plugin, using this you can directly call and send sms from the app you built.
    
     
    //you can use it using this method as reference
    // this is for calling to a required number 
    Future _callContact(BuildContext context, String number) async {
        final url = 'tel:$number';
        if (await canLaunch(url)) {
          await launch(url);
            }
     else {
          const snackbar = SnackBar(content: Text('Can\'t make a call'));
          Scaffold.of(context).showSnackBar(snackbar);
        }
      }
// this is for sms
Future _smsContact(BuildContext context, String number) async {
    final url = 'sms:$number';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      const snackbar = SnackBar(content: Text('Can\'t make a call'));
      Scaffold.of(context).showSnackBar(snackbar);
    }
  }
Related