dartflutterussd

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


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';
}

Solution

  • 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#'));