getDeclaration method

SourceDeclaration? getDeclaration()

Resolves the most specific declaration type.

Returns:

  • The declaration as its most specific type (Class, Enum, etc.)
  • null if the type doesn't match any known declaration variant

Checks types in this order:

  1. ClassDeclaration
  2. EnumDeclaration
  3. TypedefDeclaration
  4. RecordDeclaration
  5. MixinDeclaration
  6. TypeVariableDeclaration

Implementation

SourceDeclaration? getDeclaration() => asClass() ?? asEnum() ?? asTypedef() ?? asRecord() ?? asMixin() ?? asTypeVariable();