launchURL static method

Future<void> launchURL(
  1. BuildContext context,
  2. String url
)

Launch URL

Implementation

static Future<void> launchURL(BuildContext context, String url) async {
  try {
    await launchUrl(
      Uri.parse(url).withScheme,
      mode: LaunchMode.externalApplication,
    );
  } catch (e) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(content: Text(TIM_t("无法打开URL"))), // Cannot launch the url
    );
  }
}