levit_dart library

High-level utility mixins and tools for Levit Dart controllers.

This kit provides abstractions for common domain patterns like task management, time-based operations, and selection logic.

Classes

InMemoryTaskCacheProvider
A default in-memory implementation of LevitTaskCacheProvider.
Levit
The primary entry point for orchestrating dependency injection and reactivity in Levit.
LevitAsyncState<T>
A specialized LevitState for asynchronous initialization.
LevitController
A base class for business logic components with automated resource management and explicit lifecycle hooks.
LevitDependency<S>
Metadata and instance container for a registered dependency.
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.
LevitRef
A lightweight bridge passed to LevitState builders.
LevitScope
A hierarchical dependency injection container for managing resource lifecycles.
LevitScopeDisposable
An interface for objects that require explicit lifecycle management within a LevitScope.
LevitScopeMiddleware
Interface for middleware hooks on dependency injection events.
LevitState<T>
A functional state provider definition.
LevitStateMiddlewareChain
Internal utility for applying the middleware chain.
LevitTaskCacheProvider
Interface for persistent task result caching.
Ls
The primary entry point for managing dependencies and ambient scopes.
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.
LxCountdown
A reactive countdown timer.
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.
StoppableService
A service that can be started, paused, resumed, and stopped.
TaskCachePolicy<T>
Configuration for caching a task's result.

Enums

TaskPriority
Priority levels for task execution.

Mixins

LevitExecutionLoopMixin
A mixin for LevitController that manages background loops and stoppable services.
LevitReactiveTasksMixin
A mixin for LevitController that combines task management with reactive state.
LevitSelectionMixin<T>
A mixin for LevitController that manages selection state.
LevitTasksMixin
A mixin for LevitController that adds advanced task management capabilities.
LevitTimeMixin
A mixin for LevitController that centralizes time-based operations like debouncing, throttling, intervals, and countdowns.

Extensions

LevitAsyncBuilderExtension on Future<T> Function()
Fluent extensions for lazy asynchronous registration using builders.
LevitAsyncInstanceExtension on Future<T>
Fluent extensions for lazy asynchronous registration of futures.
LevitAsyncStateExtension on LevitAsyncState<T>
Extensions for LevitAsyncState to unwrap futures.
LevitBuilderExtension on T Function()
Fluent extensions for registration using builder functions.
LevitInstanceExtension on T
Fluent extensions for immediate dependency registration.
LevitScopeImplicitScopeExtension on LevitScope
Implicit scoping extensions for LevitScope.
LevitScopeToBuilderExtension on T
Extension to convert any object to a builder function.
LevitStateExtension on LevitState<T>
Internal helper to reuse LevitController's cleanup logic without inheritance. Ergonomic extensions for LevitState functional providers.
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.
LxNamingExtension on R
Fluent API for naming reactive variables.
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.

Properties

autoLinkCaptureKeyForTesting Object
no setter

Functions

getProviderTag(LevitState provider, String? tag) String
Helper to generate a unique tag for a functional provider instance.
runCapturedForTesting<R>(R builder(), [String? ownerId]) → R

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.