declaration library

πŸ“œ Jetleaf Declarations Subsystem

This library provides the runtime declaration models representing Dart classes, methods, constructors, fields, parameters, and annotations within the Jetleaf mirrorless reflection and AOT code generation pipeline.


🌳 Declaration Structural Tree

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     ClassDeclaration                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”œβ”€β”€ Constructors:     List<ConstructorDeclaration>          β”‚
β”‚ β”œβ”€β”€ Methods:          List<MethodDeclaration>               β”‚
β”‚ β”œβ”€β”€ Fields:           List<FieldDeclaration>                β”‚
β”‚ β”œβ”€β”€ Annotations:      List<AnnotationDeclaration>           β”‚
β”‚ β”œβ”€β”€ SuperClass:       LinkDeclaration?                      β”‚
β”‚ β”œβ”€β”€ Interfaces:       List<LinkDeclaration>                 β”‚
β”‚ └── Mixins:           List<LinkDeclaration>                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Exports Categorization

πŸ›οΈ Type Declarations

βš™οΈ Member Declarations

πŸ”— Linkages & Packages

  • LinkDeclaration β€” lazy reference link between type references and declaration targets.
  • Package β€” package descriptor representing package boundaries and versions.
  • Asset β€” non-source asset file descriptor.

🎯 Usage Example: Inspecting Class Declarations

import 'package:jetleaf_tools/declaration.dart';
import 'package:jetleaf_tools/jetleaf_tools.dart';

void inspectComponent(ClassDeclaration decl) {
  print('Class: ${decl.getName()} (Package: ${decl.getPackage().getName()})');

  // Inspect constructors
  for (final ctor in decl.getConstructors()) {
    final name = ctor.getName().isEmpty ? '(default)' : ctor.getName();
    print('  Constructor: $name');
    for (final param in ctor.getParameters()) {
      print('    - ${param.getType()} ${param.getName()} (Required: ${param.getIsRequired()})');
    }
  }

  // Inspect methods
  for (final method in decl.getMethods()) {
    print('  Method: ${method.getReturnType()} ${method.getName()}()');
  }
}

Classes

AnnotationDeclaration
Base class for all annotations.
AnnotationFieldDeclaration
Represents a field of an annotation.
Asset
Represents a non-Dart static resource (e.g., HTML, CSS, images).
BaseDeclaration
Base abstraction for all Jetleaf declaration models.
CacheSerializable
Interface for declarations that can serialize/deserialize to/from binary cache.
ClassDeclaration
Represents a reflected Dart class and all of its metadata, including fields, methods, constructors, superclasses, mixins, interfaces, and declaration-level modifiers (abstract, sealed, etc.).
ClosureDeclaration
Represents a closure or anonymous function as a class-like declaration within the Jetleaf reflection system.
ConstructorDeclaration
Represents a constructor of a Dart class, including its parameters, modifiers (const, factory), and the ability to create new instances.
Declaration
A named, typed declaration representing a concrete program element.
EntityDeclaration
A uniquely identifiable declaration representing a runtime entity.
EnumDeclaration
Represents a reflected Dart enum type, providing access to its enum entry names, metadata, and declared members (fields, methods).
EnumFieldDeclaration
Abstract base class representing a field (value) within an enum declaration.
FieldDeclaration
Represents a field (variable) declared within a Dart class, extension, enum, or mixin.
FunctionDeclaration
Specialized LinkDeclaration for function type references.
GenerativeAsset
Base class representing a resource asset with a no-args constructor.
GenerativePackage
Base class representing a package resource with a no-args constructor.
LibraryDeclaration
Represents a Dart library declaration within Jetleaf’s reflection and generation system.
LinkDeclaration
Abstract base class for type references in reflection systems.
MemberDeclaration
A source-level declaration that is owned by a class.
MethodDeclaration
Represents a method declaration in a Dart class, extension, mixin, or top-level scope.
MixinDeclaration
Represents a reflected Dart mixin declaration, providing access to its members, type constraints, and metadata.
Package
Represents a Dart package within the Jetleaf reflection and code generation system.
ParameterDeclaration
Represents a parameter in a constructor or method, with metadata about its name, type, position (named or positional), and default value.
RecordDeclaration
Represents a reflected Dart record type.
RecordFieldDeclaration
A representation of an individual field within a Dart record type in the Jetleaf reflection system.
SourceDeclaration
A declaration that originates directly from source-level Dart code.

Enums

TypeKind
Enumerates the different kinds of Dart types recognized by Jetleaf’s reflection and type resolution system.