launch method

Future<bool> launch({
  1. LaunchMode mode = LaunchMode.platformDefault,
  2. bool showErrorToas = true,
})

Implementation

Future<bool> launch({LaunchMode mode = LaunchMode.platformDefault, bool showErrorToas = true}) async {
  try {
    if (await canLaunchUrlString(this)) {
      return launchUrlString(this, mode: mode);
    }
    if (showErrorToas) {
      MToast.showToast('无法打开链接');
    }
    return false;
  } catch (_) {
    if (showErrorToas) {
      MToast.showToast('无法打开链接');
    }
    return false;
  }
}