design library

Jetleaf Standard Library

This library exposes the core foundational utilities of the Jetleaf framework—providing rich APIs for resource handling, I/O streams, collections, math, reflection, system access, time utilities, and more.

Classes

AbsolutePathValidator
Validates that a URI contains an absolute path (starting with '/').
AdaptableList
A specialized list collection that can adapt itself or another source into a strongly-typed List of elements.
AdaptableMap
A specialized map collection that can adapt itself or another source into a strongly-typed Map of keys and values.
AdaptableSet
A specialized set collection that can adapt itself or another source into a strongly-typed Set of elements.
AllowedDomainsValidator
Validates that a URI's host matches one of the allowed domains.
ArrayList<E>
A resizable array implementation similar to Java's ArrayList.
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.
CaseInsensitiveMap<V>
A map that performs case-insensitive string key lookups while preserving the original casing of keys.
Character
A wrapper class for single characters that provides Java-like functionality.
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.
ConsolePrintStream
A concrete implementation of PrintStream that writes to the console using stdout.
Currency
Abstract base class for currency operations following ISO 4217 standards.
DateTimeFormatter
A formatter and parser for date-time objects based on patterns, similar to Java's DateTimeFormatter.
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.
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.
Garbage<T>
A lightweight, generic wrapper representing a tracked runtime resource managed by the Jetleaf garbage collection system.
GarbageCollector
A centralized, map-backed runtime garbage manager used by Jetleaf to track, evict, and periodically clean up cached or temporary objects.
GenericStream<T>
A sequence of elements supporting sequential and parallel aggregate operations.
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.
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.
LanguageRange
Represents a language range as defined in RFC 4647.
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.
MethodUtils
Provides reflective utility functions for working with Jetleaf runtime Method and MethodDeclaration instances.
MimeType
An immutable, industry-standard value object representing a Multipurpose Internet Mail Extensions (MIME) type, as defined in RFC 2045 and RFC 2046.
MimeTypeUtils
A low-level parsing and validation engine providing stateless utilities for handling MIME/Media Types according to RFC 2045, RFC 2046, and RFC 7231 structural rules.
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.
Null
A minimal placeholder class representing a null-like object.
NumberUtils
An administrative utilities toolkit providing type-safe conversions, numerical downcasting safety, boundary overflow assertions, and contextual string radix decoding across standard platform primitives and custom object-wrapped types.
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.
PackageOrderComparator
A comparator that orders classes based on their package hierarchy and origin.
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.
Provider<T>
A generic provider interface for supplying instances of type T.
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.
RegexUtils
A collection of commonly used regular expressions, provided as constants.
Runnable
A simple contract for objects that can be executed.
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.
SimpleProvider<T>
Simple, immutable implementation of Provider that always returns a pre-defined, constant value.
SinkOutputStream
A concrete implementation of OutputStream that wraps a Dart IOSink, allowing byte, list of bytes, and string data to be written to any underlying sink, such as files, sockets, or stdout.
Stack<E>
A last-in-first-out (LIFO) stack implementation, mimicking Java's Stack.
StandardDoubleStream
Private implementation of DoubleStream that wraps an Iterable of doubles.
StandardGenericStream<T>
Implementation of GenericStream that wraps an Iterable and provides some basic stream operations.
StandardIntStream
Private implementation of IntStream.
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.
StringInputStream
A character-based input stream backed by an encoded String.
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.
Thread<T>
Emulates Java's Thread class using Dart's Isolate.
ThreadMessage
Wrapper message passed to the Isolate's entry point function.
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.
Version
Represents a semantic version in Jetleaf with major, minor, and patch components.
VersionRange
Represents a simple semantic version range in Jetleaf.
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

ListChangeType
Represents the type of change that occurs in a List.
MapChangeType
Represents the type of change that occurs in a Map.

Extensions

BoolExtensions on bool
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>
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.
StackTraceExtensions on StackTrace
Extension on StackTrace to print itself.
StringExtensions on String
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.
TypeExtension on Type
UriExtension on Uri
Extension on Dart's Uri class to convert it into a Url instance.

Properties

GC → GarbageCollector
The global, singleton garbage collector instance used by Jetleaf.
final
isolateLocalValueStore → _IsolateLocalValueStore
Singleton instance of the _IsolateLocalValueStore.
final

Functions

optional<T>(T? value) → Optional<T>
Wraps the given value in an Optional container.
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 Closeable>(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.
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.
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.
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.
Predicate<T> = Bool Function(T value)
A function that takes a value of type T and returns a boolean.
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

ArgumentResolutionException
Base class for exceptions thrown during argument resolution.
AssetLoaderException
An exception thrown when an asset cannot be loaded by the Jetleaf bundler.
BuildableCacheException
Exception thrown when a cache deserialization or validation failure occurs during binary cache loading.
BuildException
An exception thrown when a build-time or configuration-time failure occurs within the Jetleaf framework.
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.
ConstructorNotFoundException
Exception thrown when a requested constructor cannot be found or invoked for a given type during resolution.
EndOfStreamException
Exception thrown when the end of a stream is reached unexpectedly.
FewerPositionalArgumentException
Thrown when a runtime invocation receives fewer positional arguments than the target function or constructor requires.
FieldAccessException
Exception thrown when reading a field or getter fails on a given type.
FieldMutationException
Exception thrown when writing to a field or setter fails on a given type.
GenericResolutionException
Exception thrown when generic type resolution fails during dynamic analysis or reflection-based processing.
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.
ImmaterialClassException
Thrown when a class exists but cannot be materialized into a concrete ClassDeclaration by Jetleaf.
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
Thrown to indicate that a malformed URL has occurred.
MethodNotFoundException
Exception thrown when a requested method cannot be found or invoked on a given type during dynamic resolution.
MissingRequiredNamedParameterException
Thrown when a required named parameter is missing during runtime method or constructor invocation.
MissingRequiredPositionalParameterException
Thrown when a required positional parameter is missing during runtime method or constructor invocation.
MorePositionalArgumentException
Thrown when a runtime invocation receives more positional arguments than the target function or constructor accepts.
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.
PrivateConstructorInvocationException
Exception thrown when a developer attempts to invoke a private constructor dynamically, which is not allowed by Jetleaf.
PrivateFieldAccessException
Exception thrown when attempting to access a private field or getter/setter on a type during runtime resolution.
PrivateMethodInvocationException
Exception thrown when a developer attempts to invoke a private method dynamically, which is not allowed by Jetleaf.
ReentrantSynchronizedException
Exception thrown when a synchronized block is reentered from the same zone.
RuntimeException
Represents an unchecked runtime exception in Jetleaf.
RuntimeResolverException
Base class for all resolver-related exceptions within the Jetleaf resolution and evaluation subsystem.
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.
UnexpectedArgumentException
Thrown when an invocation receives an argument that does not correspond to any declared parameter, usually a named parameter that the target method or constructor does not define.
UnresolvedTypeInstantiationException
Exception thrown when Jetleaf is unable to instantiate a class or resolve a constructor because the runtime type is unresolved.
UnsupportedOperationException
Thrown to indicate that a requested operation is not supported.
UnsupportedRuntimeOperationException
Exception thrown when an operation cannot be performed due to runtime environment limitations.
UriPathMatchingException
Exception thrown when a URI or route path fails to match a defined template in a path matcher.