levit_reactive library

Pure Dart reactive state management primitives.

This package provides the low-level reactive engine of the Levit framework. It is dependency-free and focuses on high-performance, fine-grained state tracking using a proxy-based mechanism.

Core Abstractions

  • LxReactive: The base interface for all reactive objects.
  • Lx: The primary entry point for creating reactive variables and managing the global reactive state (proxies, batches, middlewares).
  • LxComputed: Derived reactive state that automatically tracks dependencies.

levit_reactive is designed to be the foundational layer for any Dart application requiring deterministic state derivation.

Classes

LevitReactiveBatch
A collection of LevitReactiveChanges captured during a batch operation.
LevitReactiveChange<T>
Represents a discrete change in a reactive variable's state.
LevitReactiveHistoryMiddleware
A standard middleware for recording the state history.
LevitReactiveMiddleware
Base class for intercepting and observing the reactive lifecycle.
LevitReactiveNotifier
A low-latency notifier for synchronous reactive updates.
LevitReactiveObserver
An observer interface used to automatically track reactive dependencies.
LevitStateMiddlewareChain
Internal utility for applying the middleware chain.
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 state manipulation methods.
LxComputed<T>
A synchronous computed value that automatically tracks its reactive dependencies.
LxError<T>
Status: Error (the operation failed).
LxFuture<T>
A reactive wrapper for a Future.
LxIdle<T>
Status: Idle (the operation has not been initiated).
LxList<E>
A reactive list that automatically notifies observers when its contents change.
LxListenerContext
A standard context descriptor for reactive listeners.
LxMap<K, V>
A reactive map that automatically notifies observers when its entries change.
LxNum<T extends num>
A reactive number with fluent arithmetic extensions.
LxReactive<T>
The foundational interface for all reactive objects in the Levit ecosystem.
LxSet<E>
A reactive set that automatically notifies observers when elements are added or removed.
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 that executes a side-effect when a source changes.
LxWorkerStat
Metrics and metadata for a particular LxWorker execution.

Extensions

LxAsyncFunctionExtension on Future<T> Function()
Extension to create LxAsyncComputed from an asynchronous function.
LxBoolExtension on bool
Specialized .lx extension for booleans.
LxDoubleExtension on double
Specialized .lx extension for doubles.
LxExtension on T
Extensions to provide the signature .lx syntax for creating reactive state.
LxFunctionExtension on T Function()
Extension to create LxComputed from a synchronous function.
LxFutureExtension on Future<T>
Extension for Future to support the lx shorthand.
LxIntExtension on int
Specialized .lx extension for integers.
LxListExtension on List<E>
Extension for List to create an LxList.
LxMapExtension on Map<K, V>
Extension for Map to create an LxMap.
LxReactiveWatchExtensions on LxReactive<T>
Shorthand extensions for creating watchers on any reactive source.
LxSetExtension on Set<E>
Extension for Set to create an LxSet.
LxStatusReactiveExtensions on LxReactive<LxStatus<T>>
Ergonomic extensions for interacting with reactive async status sources.
LxStreamExtension on Stream<T>
Extension for Stream to support the lx shorthand.

Typedefs

LxDouble = LxNum<double>
Type alias for a reactive double.
LxInt = LxNum<int>
Type alias for a reactive integer.
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.