couldCanonicalize method

bool couldCanonicalize(
  1. Uri url,
  2. Uri canonicalUrl

Without accessing the filesystem, returns whether or not passing url to canonicalize could possibly return canonicalUrl.

This is expected to be very efficient, and subclasses are allowed to return false positives if it would be inefficient to determine whether url would actually resolve to canonicalUrl. Subclasses are not allowed to return false negatives.


bool couldCanonicalize(Uri url, Uri canonicalUrl) =>
    (url.scheme == 'file' || url.scheme == 'package' || url.scheme == '') &&
        .couldCanonicalize(Uri(path: url.path), canonicalUrl);