Message body disappear after hash symbol in flutter url_launcher when send a SMS

154 Views Asked by At

I'm using url_launcher in flutter to send SMS.

But there are hash symbols in my message body, and after hash symbols ,all message is disappear.

For example,

String uri= 'sms:$phoneNumber?body=123##456';

    if (await canLaunch(uri)) {
      await launch(uri);
    } else {
      if (await canLaunch(uri)) {
        await launch(uri);
      } else {
        throw 'Could not launch $uri';
      }
    }

The number '456' is disappear on SMS.

How to solve the problem ?

1

There are 1 best solutions below

1
On BEST ANSWER

Replace "#" with "%23"

String uri= 'sms:$phoneNumber?body=123%23%23456';