levit_dart_core library
Core Dart composition layer for the Levit ecosystem.
This library defines lifecycle-aware application building blocks and unifies dependency injection and reactive state access:
- Levit: unified facade for scope, reactive batching, and middleware APIs.
- LevitController: lifecycle-aware owner for business logic and resources.
- LevitStore and LevitAsyncStore: scoped, reusable state definitions.
The library re-exports levit_scope and levit_reactive as foundational
runtime dependencies.
Classes
- Levit
- The central entry point for the Levit framework.
-
LevitAsyncStore<
T> - A specialized store for asynchronous initialization.
- LevitController
- A base class for business logic components.
-
LevitDependency<
S> - Metadata container for a dependency registered within a LevitScope.
- LevitDisposable
- A resource with an explicit, optionally asynchronous disposal operation.
- LevitDisposalFailure
- One failure captured while a scope or resource owner was being disposed.
- LevitReactiveBatch
- A collection of LevitReactiveChanges captured during a batch operation.
-
LevitReactiveChange<
T> - Represents a state transition in a reactive variable.
- LevitReactiveHistoryMiddleware
- A standard middleware for recording the state history.
- LevitReactiveMiddleware
- Base class for intercepting reactive system events.
- LevitReactiveNotifier
- A low-latency notifier for synchronous reactive updates.
- LevitReactiveObserver
- An observer interface used to automatically track reactive dependencies.
- LevitReactiveReadResolver
- Optional interface for observers that can canonicalize reactive reads.
- LevitRef
- A bridge for interacting with the dependency injection system from a LevitStore.
- LevitResourceOwner
- A lifecycle boundary that owns arbitrary cleanup resources.
- LevitScope
- A hierarchical dependency injection container.
- LevitScopeDisposable
- An interface for objects that participate in the LevitScope lifecycle.
- LevitScopeKey
- Typed key for dependency registrations.
- LevitScopeMiddleware
- Interface for observing and intercepting LevitScope lifecycle events.
-
LevitStore<
T> - A portable container definition for managing reusable state.
- Ls
- The global entry point for accessing the LevitScope system.
- Lx
- The global entry point for the Levit reactive engine.
-
LxAsyncComputed<
T> - An asynchronous computed value that reflects state transitions via LxStatus.
-
LxBase<
T> - The primary implementation base for reactive objects.
- LxBool
- A reactive boolean with specialized toggling methods.
-
LxComputed<
T> - A value derived from other reactive objects.
- LxDouble
- A reactive double with arithmetic extensions.
-
LxError<
T> - Status: Error (the operation failed).
-
LxFamily<
K, R extends LxReactive> - Lazily creates, caches, and disposes reactive resources by key.
- LxFamilyEviction
- Cache eviction policy for LxFamily entries.
- LxFamilyKeepAlive
- An eviction policy that retains every family entry.
- LxFamilyWhenInactive
- An eviction policy based on reactive listener activity.
-
LxFuture<
T> - A reactive wrapper for a Future.
-
LxIdle<
T> - Status: Idle (the operation has not been initiated).
- LxInt
- A reactive integer with arithmetic extensions.
-
LxList<
E> - A reactive list that notifies observers on modification.
- LxListenerContext
- A standard context descriptor for reactive listeners.
-
LxMap<
K, V> - A reactive map that notifies observers on modification.
-
LxReactive<
T> - The foundational interface for all reactive objects.
-
LxSet<
E> - A reactive set that notifies observers on modification.
-
LxState<
T> - A reactive state container for immutable data flow.
-
LxStatus<
T> - A sealed hierarchy representing the status of an asynchronous operation.
-
LxStream<
T> - A reactive wrapper for a Stream.
-
LxSuccess<
T> - Status: Success (the operation completed with a result).
-
LxVar<
T> - A reactive variable that holds a mutable value.
-
LxWaiting<
T> - Status: Waiting (the operation is active).
-
LxWorker<
T> - A reactive observer for side-effects.
- LxWorkerStat
- Performance metrics for an LxWorker.
Enums
- LxAsyncConcurrency
- Controls admission of overlapping asynchronous reactive computations.
- LxStreamCompletionPolicy
- Determines what an LxStream does when its current source completes.
Mixins
- LevitResourceOwnership
- Reusable implementation of LevitResourceOwner.
Extensions
-
LevitAsyncBuilderExtension
on Future<
T> Function() - Extensions for registering asynchronous builder functions.
-
LevitAsyncInstanceExtension
on Future<
T> - Extensions for registering asynchronous dependencies.
- LevitBuilderExtension on T Function()
- Extensions for registering builder functions.
- LevitInstanceExtension on T
- Extensions for registering instances directly into the active LevitScope.
- LevitScopeImplicitScopeExtension on LevitScope
- Extensions for executing code within a specific LevitScope.
- LevitScopeToBuilderExtension on T
- Extension to convert any object to a builder function.
-
LxAsyncFunctionExtension
on Future<
T> Function() - Extension to create LxAsyncComputed from an asynchronous function.
- LxBoolExtension on bool
-
Specialized
.lxextension for booleans. - LxDoubleExtension on double
- Specialized extensions for double.
- LxExtension on T
- Extensions to create reactive variables from primitive values.
- LxFunctionExtension on T Function()
- Extension to create LxComputed from a synchronous function.
-
LxFutureExtension
on Future<
T> - Extensions for converting Futures to LxFutures.
- LxIntExtension on int
-
Specialized
.lxextension for integers. -
LxListExtension
on List<
E> - Helper extensions for creating reactive collections.
-
LxMapExtension
on Map<
K, V> - Helper extensions for creating reactive maps.
- LxNamingExtension on R
- Fluent extensions for naming and configuring reactive objects.
-
LxReactiveWatchExtensions
on LxReactive<
T> - Extensions for creating watchers from any reactive source.
-
LxSetExtension
on Set<
E> - Helper extensions for creating reactive sets.
-
LxStatusReactiveExtensions
on LxReactive<
LxStatus< T> > - Ergonomic extensions for interacting with reactive async status sources.
-
LxStreamExtension
on Stream<
T> - Extensions for converting Streams to LxStreams.
Properties
- autoLinkCaptureKeyForTesting → Object
-
no setter
Functions
-
requireStoreRefScope(
LevitScope? scope) → LevitScope -
Returns
scopeor throws when a LevitRef is used before scope attachment. -
runCapturedForTesting<
R> (R builder(), [String? ownerId]) → R
Typedefs
- LxOnBatch = dynamic Function() Function(dynamic next(), LevitReactiveBatch change)
- Helper typedefs for middleware interception.
- LxOnDispose = void Function() Function(void next(), LxReactive reactive)
- Helper typedefs for middleware interception.
- LxOnSet = void Function(dynamic value) Function(void next(dynamic value), LxReactive reactive, LevitReactiveChange change)
- Helper typedefs for middleware interception.
Exceptions / Errors
- LevitDisposalException
- Aggregate error thrown after best-effort disposal has finished.