Flutter url_launcher with multiple phone numbers

Issue

I am developing an app on Flutter for both Android and iOS platform.

I have two contact numbers. I would like that the user, when clicking on one of them, gets to choose which to call. For example, in iOS it should open the action sheet with both possibilities (e.g. as it happens when clicking on an activity with multiple contacts through Google search).

Currently, I’m using Flutter 2.0.1 and url_launcher 6.0.2.

The method launch(url) works fine in both platforms if I put in the url a single number (e.g. "tel:123456").

How can I format the url in order to contain two (or more) numbers?

I tried to insert more numbers with some divider chars, e.g "tel:123456,654321", but it didn’t work.

Thank you all.

Solution

This should be done programmatically on flutter side, i.e. you should create popup dialog or widget, and on telephone tap open it. Then, inside popup show buttons for each number with url_launcher calls. It will be much more configurable, than something fixed inside the plugin.

Answered By – A. Tratseuski

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *