launchURL static method

Future<void> launchURL(
  1. String url, {
  2. LaunchMode? mode,
})

Launches the url in an external browser.

Implementation

static Future<void> launchURL(String url, {LaunchMode? mode}) async {
  AnalyticsHelper.trackOutlink(url: url);

  try {
    await launchUrl(
      Uri.parse(url),
      mode:
          mode ??
          (Platform.isAndroid
              ? LaunchMode.externalApplication
              : LaunchMode.platformDefault),
    );
  } catch (e) {
    throw 'Could not launch $url,Error: $e';
  }
}