forElement static method
Returns the name that corresponds to element
.
If the element is private, the name includes the library URI.
If the name is a setter, the name ends with =
.
Implementation
static Name? forElement(Element2 element) {
var name = element.lookupName;
if (name == null) {
return null;
}
if (name.startsWith('_')) {
var libraryUri = element.library2!.uri;
return Name(libraryUri, name);
} else {
return Name(null, name);
}
}