makePhoneCall function

Future<void> makePhoneCall(
  1. String phoneNumber
)

Initiates a phone call using an external application.

phoneNumber is the phone number to call.

Throws an exception if the phone call launch fails.

Implementation

Future<void> makePhoneCall(final String phoneNumber) async {
  final phoneUri = Uri(scheme: 'tel', path: phoneNumber);
  if (await canLaunchUrl(phoneUri)) {
    await launchUrl(phoneUri);
  } else {
    throw Exception('Could not launch phone call');
  }
}