matches<A> abstract method

bool matches<A>([
  1. Class<A>? type
])

Checks whether this annotation instance matches the type parameter A.

This is typically used to determine if a particular annotation is present on a class, method, or field, and if it can be treated as type A.

Example:

@SomeAnnotation()
class MyClass {}

final annotation = getAnnotation(MyClass);
if (annotation.matches<SomeAnnotation>()) {
  // Do something with the annotation
}

@return true if this annotation is of type A, false otherwise.

Implementation

bool matches<A>([Class<A>? type]);