launchPhone static method

dynamic launchPhone(
  1. dynamic telephoneNumber, {
  2. LaunchMode mode = LaunchMode.platformDefault,
})

Launch the phone number.

Implementation

static launchPhone(telephoneNumber,
    {LaunchMode mode = LaunchMode.platformDefault}) async {
  String telephoneUrl = "tel:$telephoneNumber";
  if (await canLaunchUrlString(telephoneUrl)) {
    await launchUrlString(
      telephoneUrl,
      mode: mode,
    );
  } else {
    showErrorNotice("Error", "Could not launch the $telephoneNumber number");
    throw "Can't phone that number.";
  }
}