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
- ClassDeclaration β complete reflective metadata model for a Dart class.
- EnumDeclaration β metadata model for Dart enums and enhanced enum entries.
- MixinDeclaration β metadata model for Dart mixins.
- RecordDeclaration β metadata model for Dart records.
βοΈ Member Declarations
- ConstructorDeclaration β reflective model for default, named, and factory constructors.
- MethodDeclaration β reflective model for static and instance methods.
- FieldDeclaration β reflective model for instance and static fields with getters/setters.
- ParameterDeclaration β reflective model for positional, named, required, and optional parameters.
- AnnotationDeclaration β reflective model for attached annotations and metadata arguments.
π 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
enumtype, 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
mixindeclaration, 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.