toUrl method

String? toUrl(
  1. String? baseUrl
)

Computes an absolute URL to the link, relative to the given baseUrl.

If the link's href is already absolute, the baseUrl is ignored.

Implementation

String? toUrl(String? baseUrl) {
  String href = this.href.removePrefix("/");
  if (href.isBlank) {
    return null;
  }
  return Href(href, baseHref: baseUrl ?? "/").percentEncodedString;
}