If canonicalLibrary (or canonicalEnclosingElement, for Inheritable subclasses) is null, href should be null.
Source
@override String get href { if (canonicalLibrary == null || canonicalEnclosingElement == null) return null; return '${canonicalEnclosingElement.canonicalLibrary.dirName}/${canonicalEnclosingElement.name}/${fileName}'; }