openLink static method

void openLink(
  1. String url
)

打开链接或者跳转到其他App @param url 链接

使用示例

void example() {
  AppUtil.openLink('https://www.apple.com');
}

Implementation

static void openLink(String url) async {
  if (GetUtils.isURL(url)) {
    try {
      final uri = Uri.parse(url);
      if (await canLaunchUrl(uri)) {
        await launchUrl(uri);
      } else {
        throw 'Could not launch $url';
      }
    } catch (e) {
      Logger.log('ppkits openLink error: $e');
    }
  }
}