onTapUrl method

Future<void> onTapUrl(
  1. String url
)

Implementation

Future<void> onTapUrl(String url) async {
  if (_urlRegex.hasMatch(url)) {
    if (!RegExp(r'^(https?:\/\/)').hasMatch(url)) {
      url = 'https://$url';
    }
    await launchUrl(Uri.parse(url));
  } else if (_emailRegex.hasMatch(url)) {
    await launchUrl(Uri.parse('mailto:$url'));
  } else if (_phoneNumberRegex.hasMatch(url)) {
    await launchUrl(Uri.parse('tel:$url'));
  }
}