safeLaunchUrl static method

void safeLaunchUrl(
  1. String url
)

Implementation

static void safeLaunchUrl(String url) async {
  final uri = Uri.parse(url);
  if (await canLaunchUrl(uri)) {
    await launchUrl(uri);
  } else {
    // Handle the case where the URL can't be launched
    print('Could not launch $url');
  }
}