launchUrl method

  1. @nonVirtual
void launchUrl(
  1. BuildContext context
)

Activate opening browser and located OgHrefBuilder.url.

This can be called once context is offered anywhere.

Implementation

@nonVirtual
void launchUrl(BuildContext context) async {
  if (widget.openLinkConfirmation != null) {
    if (!await widget.openLinkConfirmation!(context, widget.url)) {
      return;
    }
  }

  if (await url_launcher.canLaunchUrl(widget.url)) {
    url_launcher.launchUrl(widget.url, mode: LaunchMode.externalApplication);
  } else {
    if (widget.onOpenLinkFailed != null) {
      widget.onOpenLinkFailed!();
    }
  }
}