destinationUrlWithFragment property

String destinationUrlWithFragment

Returns the destination URL with fragment (if there was any).

For example, let's say the original HTML at http://example.com/path/ includes this code:

<a href="../about/#contact">...</a>

In this case destination's Destination.url will be http://example/about/ (because destinations shouldn't be duplicated when there are more anchors on the page).

That works for most needs of linkcheck but sometimes we need the resolved destination URL with the original fragment. For that, there is destinationUrlWithFragment.

Implementation

String get destinationUrlWithFragment {
  if (fragment == null) return destination.url;
  return '${destination.url}#$fragment';
}