getAuthor method
Retrieves the Author annotation applied to this element, if present.
This method inspects the element’s direct annotations and returns the first instance of Author found. It does not search inherited annotations from superclasses or interfaces.
Returns
- An Author object if the annotation is present directly on this element.
nullif no Author annotation is applied.
Example
@Author(name: "Alice", email: "alice@example.com")
class MyClass {}
final clazz = Class.forName<MyClass>("MyClass");
final author = clazz.getAuthor();
print(author?.name); // → "Alice"
Notes
- This is a direct annotation lookup. Use
getAnnotation<T>()if you want to include inherited annotations.
Implementation
@override
Author? getAuthor() {
checkAccess("getAuthor", DomainPermission.READ_TYPE_INFO);
return getDirectAnnotation<Author>();
}