getInstance<Instance> abstract method

Instance getInstance<Instance>()

Attempts to retrieve the actual annotation instance.

Note: Availability depends on the reflection implementation.

Returns:

  • The original annotation instance if available
  • null if instance access isn't supported

Example:

final instance = annotation.getInstance();
if (instance is Deprecated) {
  print(instance.message);
}

Implementation

Instance getInstance<Instance>();