openLink static method

void openLink(
  1. String url
)

Implementation

static void openLink(String url) async {
  final Uri uri = Uri.parse(url);
  // Check if the link can be opened
  if (await canLaunchUrl(uri)) {
    await launchUrl(
      uri,
      mode: LaunchMode.externalApplication, // Opens in browser or external app
    );
  } else {
    throw 'Could not launch $url';
  }
}