hasDirectAnnotation<A> method

bool hasDirectAnnotation<A>()

Checks if this element has a specific annotation.

Type Parameters:

  • A: The annotation type to check for

Returns:

  • true if the annotation is present
  • false otherwise

Example:

if (field.hasDirectAnnotation<Transient>()) {
  print('Field is transient and will not be serialized');
}

Implementation

bool hasDirectAnnotation<A>() {
  checkAccess('hasDirectAnnotation', DomainPermission.READ_ANNOTATIONS);
  return getDirectAnnotation<A>() != null;
}