The dialer is not showing full ussd code eg: *123*

2019-07-13 09:28发布

I am using the url_launcher plugin for call, but the dialer is not showing the # character:

String url = 'tel:*123#';
if (await canLaunch(url)) {
    await launch(url);
} else {
    throw 'Could not launch $url';
}

1条回答
Luminary・发光体
2楼-- · 2019-07-13 10:13

You need to use URL encoding for special character in a URL.

So # equals %23

This will work launch('tel:\*123\%23');

Other Way is to encode the number typed by user and pass it through Uri.encodeFull(urlString) or Uri.encodeComponent(urlString)

Like this.

launch("tel:" + Uri.encodeComponent('*123#'));
查看更多
登录 后发表回答