openLink function

Future<void> openLink(
  1. String url
)

Implementation

Future<void> openLink(String url) async {
  final uri = Uri.parse(url);

  if (await canLaunchUrl(uri)) {
    await launchUrl(
      uri,
      mode: LaunchMode.platformDefault, // browser / app
    );
  } else {
    throw 'Could not launch $url';
  }
}