Runtime top-level property
_MetaRuntimeProvider
Runtime
final
A central, globally accessible proxy for runtime metadata in JetLeaf.
The _MetaRuntimeProvider
class is the internal implementation behind the
global Runtime instance. It delegates all reflection and metadata queries
to a configured RuntimeProvider that is registered during bootstrap.
Once initialized, it allows the system to:
- Discover all reflected Dart entities (classes, enums, mixins, typedefs, etc.).
- Access runtime metadata such as Packages, Assets, LibraryDeclarations, etc.
- Query annotations, fields, methods, constructors, and more from a single, consistent API.
⚠️ Initialization Requirement
The register
method must be invoked before calling any query methods,
typically from generated bootstrap code:
void main() {
final provider = MyGeneratedRuntimeProvider();
Runtime.register(StandardRuntimeRegistry.create(provider));
runApp();
}
final clazz = Runtime.getAllClasses().firstWhere(
(c) => c.getName() == 'MyService',
);
This singleton is the globally accessible runtime registry. It must be registered before any queries are made.
Example:
void main() {
Runtime.register(MyGeneratedRegistry());
print(Runtime.getAllPackages());
}
Implementation
final _MetaRuntimeProvider Runtime = _MetaRuntimeProvider._();