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