AnnotationDeclaration class abstract

Represents an annotation that has been applied to a class, method, field, parameter, or other Dart declarations at runtime.

This interface gives you access to:

  • The TypeDeclaration of the annotation
  • The arguments used when the annotation was constructed

Example

for (final annotation in reflectedClass.getAnnotations()) {
  print(annotation.getTypeDeclaration().getName());
  print(annotation.getArguments());
}
Inheritance

Constructors

AnnotationDeclaration()
Represents an annotation that has been applied to a class, method, field, parameter, or other Dart declarations at runtime.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getDartType() → DartType?
The analyzer DartType of the entity for enhanced type operations.
inherited
getDebugIdentifier() String
The debug identifier for the entity.
inherited
getElement() → Element?
The analyzer element associated with this declaration.
inherited
getField(String name) AnnotationFieldDeclaration?
Returns a specific field by name.
getFieldNames() List<String>
Returns a list of the annotation's field names.
getFields() List<AnnotationFieldDeclaration>
Returns the fields of the annotation.
getFieldsWithDefaults() Map<String, AnnotationFieldDeclaration>
Returns a map of the annotation's fields that have default values, keyed by their name.
getFieldsWithUserValues() Map<String, AnnotationFieldDeclaration>
Returns a map of the annotation's fields that have user-provided values, keyed by their name.
getInstance() → dynamic
Returns the instance of the annotation.
getIsPublic() bool
Checks if this declaration is a public declaration.
inherited
getIsSynthetic() bool
Checks if a declaration is a synthetic declaration.
inherited
getLinkDeclaration() LinkDeclaration
Returns the type of the annotation.
getMappedFields() Map<String, AnnotationFieldDeclaration>
Returns a map of the annotation's fields, keyed by their name.
getName() String
Gets the name of the declared element.
inherited
getType() Type
Gets the runtime type of the declared element.
inherited
getUserProvidedValues() Map<String, dynamic>
Returns the user provided values of the annotation.
hasAnalyzerSupport() bool
Returns true if this declaration has analyzer information available.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, Object>
Returns a JSON representation of this entity.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited