lang library

🔡 JetLeaf Language & Utility Core

This library exposes extended Dart primitives, collections, optional types, I/O streams, date/time utilities, math types, regex, and more.


🧩 Key Areas:

  • Extended primitives and collections
  • Custom numeric types (Integer, BigDecimal, etc.)
  • I/O abstractions (InputStream, OutputStream, FileReader)
  • Streams API similar to Java's Stream
  • Date and time (LocalDateTime, ZonedDateTime)

@author Evaristus Adimonyemma @emailAddress evaristusadimonyemma@hapnium.com @organization Hapnium

Classes

AbsolutePathValidator
Validates that a URI contains an absolute path (starting with '/').
AllowedDomainsValidator
Validates that a URI's host matches one of the allowed domains.
Annotation
Provides reflective access to annotations applied to declarations.
AnnotationDeclaration
Represents an annotation that has been applied to a class, method, field, parameter, or other Dart declarations at runtime.
AnnotationFieldDeclaration
Represents a field of an annotation.
ArrayList<E>
A resizable array implementation similar to Java's ArrayList.
Asset
🍃 JetLeaf Framework - Represents a non-Dart static resource (e.g., HTML, CSS, images).
AssetImplementation
A concrete, immutable implementation of the Asset interface.
AssetPathResource
Represents a resource that can be loaded from a path-based asset.
AssetResource
An abstract representation of a resource that wraps either:
AutoCloseable
An object that may hold resources (such as file or socket handles) until it is closed.
BaseStream<T, S extends BaseStream<T, S>>
Base interface for streams, which are sequences of elements supporting sequential and parallel aggregate operations.
BigDecimal
A wrapper class for precise decimal arithmetic.
BigInteger
A wrapper class for arbitrary precision integers.
Boolean
A wrapper class for bool that provides Java-like functionality and methods.
BufferedInputStream
A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods.
BufferedOutputStream
The class implements a buffered output stream.
BufferedReader
Reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.
BufferedWriter
Writes text to a character-output stream, buffering characters to provide efficient writing of characters, arrays, and strings.
BulkChange
Represents multiple observable events grouped together.
Byte
A comprehensive wrapper class for byte operations, supporting both single bytes and byte collections.
ByteArray
A wrapper for byte arrays similar to Java's byte[] with utility methods.
ByteArrayInputStream
A byte-based input stream that reads from a Uint8List buffer.
ByteArrayOutputStream
An OutputStream that writes to a growable internal byte buffer.
ByteStream
A stream of bytes similar to Java's InputStream/OutputStream.
Character
A wrapper class for single characters that provides Java-like functionality.
Class<T>
Provides reflective access to Dart class types and their metadata.
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.).
ClassLoader
An abstract class loader that manages the loading and caching of class metadata.
ClassLoaderStats
Statistics and metrics for ClassLoader cache performance monitoring.
ClassPathResource
Provides access to resources, classes, methods, and fields located in a package's classpath.
ClassType<T>
The ClassType class in Jetleaf represents a reference to a Dart class, optionally including metadata such as package, protection domain, or type declaration.
ClassUtils
A utility class that provides static methods for working with class hierarchies and type relationships in Dart's reflection system.
Closeable
An object that may hold resources until it is closed.
Collector<T, A, R>
A mutable reduction operation that accumulates input elements into a mutable result container, optionally transforming the accumulated result into a final representation after all input elements have been processed.
Collectors
Implementations of Collector that implement various useful reduction operations, such as accumulating elements into collections, summarizing elements according to various criteria, etc.
Comparator<T>
An abstract class that imposes a total ordering on a collection of objects of type T.
ConfigurableRuntimeProvider
A mutable context used to collect and assemble metadata during the framework’s initialization or AOT compilation phase.
ConsolePrintStream
A concrete implementation of PrintStream that writes to the console using stdout.
Constant
Constant class containing predefined constants used across the application.
Constructor
Provides reflective access to class constructor metadata and instantiation.
ConstructorDeclaration
Represents a constructor of a Dart class, including its parameters, modifiers (const, factory), and the ability to create new instances.
Currency
Abstract base class for currency operations following ISO 4217 standards.
Declaration
Represents any top-level or member declaration in Dart code, such as a class, method, field, enum, typedef, etc., and exposes its metadata for reflection.
DefaultAssetPathResource
Default implementation of AssetPathResource that resolves assets from the runtime environment using a path or filename.
DefaultClassLoader
The default system implementation of ClassLoader with comprehensive caching.
DefaultClassPathResource
Default implementation of ClassPathResource that resolves and provides access to classes, methods, fields, and packages from the Dart runtime.
Double
A wrapper class for double that provides Java-like functionality and methods.
DoubleStream
A sequence of primitive double-valued elements supporting sequential and parallel aggregate operations.
EntityDeclaration
An abstract base class that defines a reflective entity in the system, providing a common identifier useful for debugging, logging, or inspection.
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.
Executable
Abstract base class for executable elements (methods, constructors, functions).
ExtensionDeclaration
Represents a Dart extension declaration at runtime.
Field
Provides reflective access to class field metadata and value manipulation.
FieldAccess
Provides reflective access to fields of a class.
FieldDeclaration
Represents a field (variable) declared within a Dart class, extension, enum, or mixin.
FileInputStream
A FileInputStream obtains input bytes from a file in a file system.
FileOutputStream
A file output stream is an output stream for writing data to a File or to a file descriptor.
FileReader
Convenience class for reading character files.
FileWriter
Convenience class for writing character files.
Float
A wrapper class for single-precision floating point numbers.
Flushable
An object that can be flushed.
Generic
A reflectable annotation that marks generic classes for type reflection.
GenericStream<T>
A sequence of elements supporting sequential and parallel aggregate operations.
GenericTypeParser
Provides utilities for parsing and analyzing generic type strings in Dart.
GenericTypeParsingResult
Represents the parsed structure of a generic type.
HashMap<K, V>
A custom implementation of a hash map that implements the Map<K, V> interface.
HashSet<E>
A custom implementation of a hash set that implements the Set<E> interface.
HostValidator
Validates that a URI contains a hostname component.
HttpUrlConnection
A concrete implementation of UrlConnection for HTTP and HTTPS protocols.
InputStream
This abstract class is the superclass of all classes representing an input stream of bytes.
InputStreamSource
A simple interface for objects that provide an InputStream.
Instance
A utility class for type checking, similar to Java's instanceof. It also provides additional methods for type checking.
InstanceArgument
Integer
A wrapper class for int that provides Java-like functionality and methods.
IntStream
A sequence of primitive int-valued elements supporting sequential and parallel aggregate operations.
LibraryDeclaration
Represents a Dart library, providing access to its URI, the containing package, and all top-level declarations inside it.
LinkDeclaration
Abstract base class for type references in reflection systems.
LinkedList<E>
A custom implementation of a doubly linked list that implements the standard List<E> interface.
LinkedQueue<E>
A queue implementation using a linked list structure, mimicking Java's LinkedList as Queue.
LinkedStack<E>
A stack implementation using a linked list structure, mimicking Java's LinkedList as Stack.
ListChange<T>
Represents a change in a List.
LocalDate
Represents a calendar date without time or timezone.
LocalDateTime
A date-time object without a timezone, composed of a LocalDate and LocalTime.
Locale
A representation of a locale, consisting of a language code and optional country and variant codes.
LocalThread<T>
A Dart equivalent of Java's ThreadLocal, scoped to the current Isolate.
LocalThreadStorageBucket<T>
A mutable storage container for a LocalThread value, bound to a specific Isolate.
LocalTime
A value object representing a time of day without any date or timezone information.
Long
A wrapper class for large integers that provides Java-like functionality.
MapChange<K, V>
Represents a change in a Map.
Member
Abstract base class representing a member of a class that extends Executable.
MemberDeclaration
Abstract base class representing a member of a class that extends Executable.
Method
Provides reflective access to class method metadata and invocation capabilities.
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.
NamedLocalThread<T>
A specialized LocalThread that includes a descriptive name for better debugging and identification.
NetworkInputStream
An InputStream implementation that reads bytes from a Dart Stream<List<int>>.
NetworkOutputStream
An OutputStream implementation that writes bytes to a Dart HttpClientRequest.
NoCredentialsValidator
Validates that a URI doesn't contain user credentials (username/password).
NoIpAddressValidator
Validates that a URI uses a domain name rather than a raw IP address.
NoSpacesValidator
Validates that a URI string doesn't contain any spaces.
Obs<T>
A reactive wrapper for values, lists, or maps.
ObsEvent
A base class representing an event in an observable system.
Optional<T>
A container object which may or may not contain a non-null value.
OrderComparator
A comparator that sorts objects based on the Ordered and PriorityOrdered interfaces.
Ordered
A contract for objects that are assigned an order or precedence value.
OrderSourceProvider
A strategy interface for providing an alternative source of order metadata for a given object.
OutputStream
This abstract class is the superclass of all classes representing an output stream of bytes.
Package
🍃 JetLeaf Framework - Represents a Dart package within the runtime context.
PackageIdentifier
Represents an abstraction for identifying the package that an object, resource, or service belongs to.
PackageNames
A central collection of constant package name identifiers used throughout the Jetleaf framework.
Parameter
Provides reflective access to method/constructor parameter metadata.
ParameterDeclaration
Represents a parameter in a constructor or method, with metadata about its name, type, position (named or positional), and default value.
ParameterizedTypeReference<T>
A runtime type reference for capturing and working with parameterized/generic types.
PermissionManager
Abstract interface for elements that can have protection domains.
PrintStream
An abstract interface representing a stream for formatted text output.
PriorityOrdered
A special marker interface for Ordered objects that should be given priority over other Ordered objects during sorting or processing.
Properties
The Properties interface provides a clean, method-based API for querying the runtime environment. Unlike direct property access, all system state is exposed via methods to enforce immutability and ensure consistent naming conventions.
ProtectionDomain
Represents a security boundary for code execution within a container or framework, defining permissions, metadata, and inheritance rules for reflection-based access.
QualifiedName
Represents an object that can provide a fully qualified name.
QueryParamValidator
Validates that a URI contains all required query parameters.
Queue<E>
A first-in-first-out (FIFO) queue interface implementation, mimicking Java's Queue.
Reader
Abstract class for reading character streams.
RecordDeclaration
Represents a reflected Dart record type.
RecordFieldDeclaration
A representation of an individual field within a Dart record type in the JetLeaf reflection system.
ReflectableAnnotation
Represents an annotation that has been applied to a class, method, field, parameter, or other Dart declarations at runtime.
RegexUtils
A collection of commonly used regular expressions, provided as constants.
ResolvableType
A comprehensive type resolution system for Dart that provides advanced type introspection, generic type handling, and assignability checking capabilities.
Resolved
An annotation used to mark classes for which AOT-compatible runtime resolvers should be generated.
ResourceDeclaration
Abstract base class for declarations of external resources in reflection systems.
Runnable
A simple contract for objects that can be executed.
RuntimeHint
A hint that defines how to interact with a specific type Object through reflection-like operations.
RuntimeHintDescriptor
Abstract interface which provides all the RuntimeHints that are registered with JetLeaf's reflection system.
RuntimeHintProcessor
An abstract interface that users can implement to configure the RuntimeHintDescriptor registry.
RuntimeMetadataProvider
A contract for providing access to reflection metadata in JetLeaf.
RuntimeProvider
Represents a runtime reflection context for a Dart application, providing access to libraries, packages, assets, and metadata.
RuntimeResolver
An interface that portrays how any code is handled in JetLeaf's reflection system.
SchemeValidator
Validates that a URI contains a scheme component (e.g., "https://").
SecureSchemeValidator
Validates that a URI uses a secure scheme (https or wss by default).
Short
A wrapper class for int representing a 16-bit signed integer.
Source
Abstract base class for all reflection metadata that can be annotated.
SourceDeclaration
Represents any top-level or member declaration in Dart code, such as a class, method, field, enum, typedef, etc., and exposes its metadata for reflection.
Stack<E>
A last-in-first-out (LIFO) stack implementation, mimicking Java's Stack.
StandardEntityDeclaration
Concrete implementation of EntityDeclaration providing standard reflection metadata.
StandardEnumFieldDeclaration
Concrete implementation of EnumFieldDeclaration representing an enum value.
StandardRuntimeProvider
Default mutable implementation of ConfigurableRuntimeProvider.
StandardSourceDeclaration
Concrete implementation of SourceDeclaration representing source-level declarations.
StandardSystemDetector
Default implementation of SystemEnvironmentDetector for standard Dart environments.
StreamBuilder<T>
A mutable builder for a GenericStream.
StreamSupport
Low-level utility methods for creating and manipulating streams.
StringBuilder
A mutable sequence of characters similar to Java's StringBuilder.
StringReader
A Reader implementation that reads characters from a String buffer.
SuppliedNamedLocalThread<T>
A NamedLocalThread that provides an initial value using a Supplier function.
SynchronizedLock
A reentrant async lock for critical section execution.
SystemDetector
Strategy interface for detecting and creating SystemEnvironment instances.
SystemPropertiesBuilder
Builder for creating _SystemProperties instances using a fluent API.
Thread<T>
Emulates Java's Thread class using Dart's Isolate.
ThreadMessage
Wrapper message passed to the Isolate's entry point function.
ToStringOptions
Configuration options for customizing toString output in JetLeaf objects.
TypeDeclaration
Represents metadata information about any Dart type — including classes, enums, typedefs, generic types like List<int>, and even nullable types.
TypedefDeclaration
Represents a reflected Dart typedef, which is a type alias for a function type, class type, or any other complex type.
TypeProvider
Interface providing access to Type information with optional source context.
TypeVariableDeclaration
Represents a reflected type variable, such as T in a generic class declaration like class MyClass<T extends num>.
UriTemplate
A utility class for defining and working with URI templates that include path variables (e.g., /users/{id}/orders/{orderId}).
UriValidator
An abstract validator for URI/URL validation.
Url
Represents a Uniform Resource Locator (URL) and provides methods to parse, construct, and open connections to the referenced resource.
UrlConnection
Represents a communication link between the application and a Url.
Uuid
A powerful, secure implementation of Universally Unique Identifiers (UUIDs) following RFC 4122 specifications.
ValueChanged<T>
Represents a change in a single observable value.
VariableResolver
Strategy interface used to resolve type variables in generic contexts.
Writer
Abstract class for writing to character streams.
ZonedDateTime
Represents a date-time with timezone information.
ZoneId
Represents a time zone identifier, abstracting the concept of region-based or offset-based zone IDs (e.g., 'UTC', 'America/New_York').

Enums

DomainPermission
Enumeration of reflection-based permissions for secure access to class metadata, fields, methods, constructors, and annotations within a container or framework.
ListChangeType
Represents the type of change that occurs in a List.
MapChangeType
Represents the type of change that occurs in a Map.
TypeKind
Defines the kind of a reflected type within the JetLeaf reflection system.
TypeVariance
Represents the variance annotations for generic type parameters in Dart.

Mixins

EqualsAndHashCode
Mixin-style contract for value-based equality, hashCode, and toString.
ToString
A mixin that provides customizable toString implementation using the same properties defined in EqualsAndHashCode.equalizedProperties.

Extensions

AssetExtension on Asset
Extension methods for Asset objects.
BoolExtensions on bool
ClassExtension on Object
Extension providing reflection capabilities to all Dart objects.
ClassHierarchyExtensions on ClassDeclaration
Extensions for type hierarchy traversal
DateTimeExtensions on DateTime
DoubleExtensions on double
DurationExtension on Duration
DynamicExtensions on dynamic
ErrorExtensions on Error
Extension on Error for printing full stack traces conveniently.
ExceptionExtensions on Exception
Extension on Exception to provide utility methods such as printing stack traces.
IntExtensions on int
IterableExtension on Iterable<T>
ListExtensions on List<T>
MapExtensions on Map<K, V>
MethodOverrideExtensions on MethodDeclaration
Extensions to support method override detection
NumExtensions on num
RuntimeExceptionExtensions on RuntimeException
Extension on RuntimeException to support pretty stack trace printing.
SetUtils on Set<Object?>
Utility extension methods for working with sets in Dart.
SortByPublic on Iterable<T>
Extension providing sorting capabilities for collections of Declaration objects.
StackTraceExtensions on StackTrace
Extension on StackTrace to print itself.
StdExtension on Stdout
Extension to simulate Java's System.out and System.err utilities in Dart.
StringExtensions on String
SystemExtension on _System
Extension on InternalSystemContext that provides access to system-level and environment-related properties similar to Java's System.getProperties() and System.getenv().
TExtensions on T?
ThrowableExtensions on Throwable
Extension on Throwable to support printing stack traces in a unified way.
ThrowingSupplierGet on ThrowingSupplier<T>
A functional interface that supplies a value and may throw an exception.
TypeDeclarationExtension on TypeDeclaration
Extension providing type casting and declaration resolution for TypeDeclaration.
TypeExtension on Type
UriExtension on Uri
Extension on Dart's Uri class to convert it into a Url instance.

Properties

isolateLocalValueStore → _IsolateLocalValueStore
Singleton instance of the _IsolateLocalValueStore.
final
MetaClassLoader ClassLoader
The default system implementation of ClassLoader with comprehensive caching.
final
Runtime → _MetaRuntimeProvider
A central, globally accessible proxy for runtime metadata in JetLeaf.
final
System → _System
Internal system facade for the JetLeaf framework.
final

Functions

synchronized<T>(Object monitor, T action()) → T
Runs the given action in a critical section, ensuring only one execution at a time per monitor object.
synchronizedAsync<T>(Object monitor, FutureOr<T> action()) FutureOr<T>
Runs the given action in a critical section, ensuring only one execution at a time per monitor object.
tryWith<T extends AutoCloseable>(T resource, TryWithAction<T> action) Future<void>
Utility for automatically closing a resource after use.

Typedefs

Accumulator<T, U> = U Function(U, T)
A function used to accumulate values in reduction operations.
AssetResourceContentDetector = bool Function(Object source)
A function signature for detecting whether a given source should be treated as content rather than a file path.
AssetResourceExtensionStrategy = String? Function(Object source)
A function signature for determining the extension of an AssetResource.
Bool = bool
An alias for the built-in bool type.
BoolCollection = List<Bool>
A list of boolean values using the Bool alias.
BoolSet = Set<Bool>
A set of unique boolean values using the Bool alias.
ConditionTester<T> = bool Function(T value)
A typedef for a predicate function that tests a condition on a value of type T.
Consumer<T> = void Function(T value)
A function that consumes a value of type T without returning anything.
DataMapper<T, U> = U Function(T value)
A function that transforms a value from type T to type U.
DateTimeCollection = List<DateTime>
A list of DateTime values.
DateTimeSet = Set<DateTime>
A set of unique DateTime values.
DurationCollection = List<Duration>
A list of Duration values.
DurationSet = Set<Duration>
A set of unique Duration values.
ExceptionSupplier = Object Function()
A function that returns an exception object to be thrown when needed.
GetValueCreator = Object? Function(Object instance, String name)
Typedef for a function that gets the value of a field on an instance of type Object.
Int = int
A shorthand alias for an integer value.
IntCollection = List<Int>
A list of integers using the Int alias.
IntSet = Set<Int>
A set of unique integers using the Int alias.
InvokeMethodCreator = Object? Function(Object instance, String method, List<Object?> args, Map<String, Object?> namedArgs)
Typedef for a function that invokes a method on an instance of type Object.
JsonMap = Map<String, dynamic>
A JSON-like structure represented as a Map<String, dynamic>.
JsonMapCollection = List<JsonMap>
A list of JSON-like maps, useful for handling multiple entities.
JsonString = Map<String, String>
A map of string keys and string values representing simple string-based JSON data.
NewInstanceCreator = Object Function(String name, List<Object?> args, Map<String, Object?> namedArgs)
Typedef for a function that creates a new instance of type Object.
Predicate<T> = Bool Function(T value)
A function that takes a value of type T and returns a boolean.
SetValueCreator = void Function(Object instance, String name, Object? value)
Typedef for a function that sets the value of a field on an instance of type Object.
StringCollection = List<String>
A list of strings.
StringSet = Set<String>
A set of unique strings.
Supplier<T> = T Function()
A function that supplies a value of type T, typically lazily or on-demand.
ThrowingSupplier<T> = T Function()
A functional interface that supplies a value and may throw an exception.

Exceptions / Errors

ClassNotFoundException
A runtime exception in Jetleaf thrown when a requested class cannot be found by the runtime provider.
ComparatorException
Exception thrown when a comparator is used with a type that is not comparable.
EndOfStreamException
Exception thrown when the end of a stream is reached unexpectedly.
IllegalArgumentException
Thrown when a method is passed an illegal or inappropriate argument.
IllegalStateException
Signals that a method has been invoked at an illegal or inappropriate time.
InvalidArgumentException
Exception thrown when an invalid argument is provided.
InvalidFormatException
Exception thrown when an invalid format is provided.
IOException
Exception thrown when an I/O operation fails.
LangException
General exception for language related errors.
MalformedUrlException
MultipleSourceException
Exception thrown when multiple class definitions with the same name are found.
NestedCheckedException
Abstract base class for checked exceptions that can wrap other exceptions.
NestedRuntimeException
Abstract base class for runtime exceptions that can wrap other exceptions.
NetworkException
Thrown to indicate an I/O error during network operations.
NoGuaranteeException
Exception thrown when a guarantee is not met. Mostly used to behave like NoGuaranteeException
NoSuchElementException
Thrown when an operation attempts to access an element that does not exist.
ReentrantSynchronizedException
Exception thrown when a synchronized block is reentered from the same zone.
RuntimeException
Represents an unchecked runtime exception in JetLeaf.
SecurityException
Exception thrown when a security violation occurs.
StreamClosedException
Exception thrown when an attempt is made to use a stream that has been closed.
ThreadInterruptedException
Exception thrown when an Isolate (thread) is unexpectedly interrupted during execution.
ThreadSpawnException
Exception thrown when an Isolate fails to start properly due to issues such as invalid entrypoint, unsupported data, or environment errors.
Throwable
Base class for all throwable exceptions in JetLeaf.
TypeResolutionException
Exception thrown when type lookup or resolution fails.
UnImplementedResolverException
Exception thrown when an operation in the ExecutableResolver is not implemented or cannot be resolved at runtime.
UnsupportedOperationException
Thrown to indicate that a requested operation is not supported.
UriPathMatchingException
Exception thrown when a URI or route path fails to match a defined template in a path matcher.