dialFaceTime method

Future<void> dialFaceTime(
  1. String number,
  2. bool videoCall
)

Initiates a FaceTime call on iOS and macOS

Implementation

Future<void> dialFaceTime(String number, bool videoCall) async {
  if (Platform.isIOS || Platform.isMacOS) {
    if (videoCall) {
      if (await url_launcher.canLaunchUrl(Uri.parse('facetime:$number'))) {
        await url_launcher.launchUrl(Uri.parse('facetime:$number'));
      }
    } else {
      if (await url_launcher.canLaunchUrl(
        Uri.parse('facetime-audio:$number'),
      )) {
        await url_launcher.launchUrl(Uri.parse('facetime-audio:$number'));
      }
    }
  } else {
    throw PlatformException(
      code: 'direct_dialer',
      message: 'This action is only available on iOS and macOS',
    );
  }
}