ClassType<T> constructor
const
ClassType<T> ({
- String? name,
- String? package,
- ProtectionDomain? pd,
- TypeDeclaration? declaration,
The ClassType
class in Jetleaf represents a reference to a Dart
class, optionally including metadata such as package, protection domain,
or type declaration.
It provides a convenient way to convert a class reference into a Class instance used by the Jetleaf framework for reflection, conditional processing, or pod registration.
Key Features:
- Supports optional class name, package, ProtectionDomain, and TypeDeclaration.
- Can convert itself into a Class instance using toClass.
- Integrates with Jetleaf's type system for dynamic class handling.
Usage Example:
import 'package:jetleaf/jetleaf.dart';
// Create a ClassType by name
final simpleClass = ClassType(name: 'UserService');
// Convert to a Jetleaf Class instance
final userClass = simpleClass.toClass();
// Create a ClassType with a TypeDeclaration
final declaredClass = ClassType(declaration: someTypeDeclaration);
final declaredClassInstance = declaredClass.toClass();
Implementation
const ClassType({this.name, this.package, this.pd, this.declaration});