Runtime top-level property

RuntimeProvider Runtime
final

🔹 JetLeaf Runtime Singleton

The Runtime object is the singleton instance of RuntimeProvider that represents the active runtime reflection and execution context within the JetLeaf framework.

This singleton is the primary entry point for runtime-aware operations, including:

  • Accessing all materialized libraries (MaterialLibrary)
  • Resolving Dart packages and their metadata
  • Enumerating runtime assets (images, configuration files, templates)
  • Executing reflected constructors, methods, and other runtime entities

⚠️ This object is internally initialized and should never be reassigned by application code. It is fully initialized at runtime startup via _InternalRuntime.

Key Features

  1. Materialized Library Access
final libraries = Runtime.getSourceLibraries();
for (final lib in libraries) {
  print(lib.getUri());
}
  1. Runtime Package Access
final packages = Runtime.getAllPackages();
for (final pkg in packages) {
  print(pkg.getName());
}
  1. Asset Access
final assets = Runtime.getAllAssets();
for (final asset in assets) {
  print(asset.getFilePath());
}
  1. Runtime Execution
final executor = Runtime.getRuntimeResolver();
executor.invokeConstructor(SomeClass, []);

Behavior

  • Immutable after initialization: the registry of libraries, assets, and packages is frozen for safe, thread-safe access.
  • Deterministic: results are consistent across queries within the same runtime.
  • Context-bound: the runtime executor reflects the state of the current runtime instance and cannot be transferred across runtimes.

Usage Notes

  • Use Runtime whenever both reflection data and runtime execution are required.
  • Avoid direct modifications; use the JetLeaf API to add packages, assets, or to perform runtime scans during the internal population phase.
  • Designed for internal framework usage, though it is exposed for diagnostics, generators, and reflection-aware applications.

Implementation

final RuntimeProvider Runtime = _InternalRuntime;