callPhoneNumber static method

Future callPhoneNumber(
  1. String phoneNumber
)

Opens the phone app to call the given phoneNumber.

Implementation

static Future callPhoneNumber(String phoneNumber) async {
  try {
    final phone = Uri.parse("tel:$phoneNumber");
    await launchUrl(phone);
  } catch (error, stackTrace) {
    ErrorLogger.instance.logError(
      error: error,
      stackTrace: stackTrace,
      file: "url_launcher_helper",
      event: "callPhoneNumber",
    );
    return Future.error(error);
  }
}