openLink function

Future<bool> openLink(
  1. String target,
  2. dynamic context
)

Implementation

Future<bool> openLink(String target, BuildContext context) async {
  final Uri? url = Uri.tryParse(target);
  if (url == null || !url.hasAuthority) {
    _log.info('Opening internally: $url');
    // not a valid URL, try local routing
    await context.push(target);
    return true;
  } else {
    _log.info('Opening external URL: $url');
    return await launchUrl(url);
  }
}