LevitReactiveMiddleware class abstract
Base class for intercepting and observing the reactive lifecycle.
Middlewares provide a unified way to implement cross-cutting concerns like logging, state persistence, undo/redo, and analytics.
Constructors
- LevitReactiveMiddleware()
-
Creates a LevitReactiveMiddleware instance.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- onBatch → LxOnBatch?
-
Intercepts and optionally wraps a batch execution.
no setter
- onDispose → LxOnDispose?
-
Intercepts and optionally wraps the disposal of a reactive object.
no setter
-
onGraphChange
→ void Function(LxReactive computed, List<
LxReactive> dependencies)? -
Observes dependencies change in a computed reactive object.
no setter
- onInit → void Function(LxReactive reactive)?
-
Observes the initialization of a reactive object.
no setter
- onReactiveError → void Function(Object error, StackTrace? stack, LxReactive? context)?
-
Called when an error occurs during notification.
no setter
- onSet → LxOnSet?
-
Intercepts and optionally wraps a value mutation.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startedListening → void Function(LxReactive reactive, LxListenerContext? context)?
-
Called when a listener is added to a reactive object.
no setter
- stoppedListening → void Function(LxReactive reactive, LxListenerContext? context)?
-
Called when a listener is removed from a reactive object.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- bypassMiddleware → bool
-
Returns
trueif middlewares are currently being bypassed.no setter - hasBatchMiddlewares → bool
-
Returns
trueif any registered middleware has an onBatch interceptor.no setter - hasDisposeMiddlewares → bool
-
Returns
trueif any registered middleware has an onDispose interceptor.no setter - hasErrorMiddlewares → bool
-
Returns
trueif any registered middleware has error observers.no setter - hasGraphChangeMiddlewares → bool
-
Returns
trueif any registered middleware has an onGraphChange observer.no setter - hasInitMiddlewares → bool
-
Returns
trueif any registered middleware has an onInit observer.no setter - hasListenerMiddlewares → bool
-
Returns
trueif any registered middleware has listener observers.no setter - hasSetMiddlewares → bool
-
Returns
trueif any registered middleware has an onSet interceptor.no setter
Static Methods
-
add(
LevitReactiveMiddleware middleware) → LevitReactiveMiddleware - Adds a middleware to the global registry.
-
clear(
) → void - Clears all currently registered middlewares.
-
contains(
LevitReactiveMiddleware middleware) → bool -
Returns
trueif the middleware is currently registered. -
remove(
LevitReactiveMiddleware middleware) → bool - Removes a middleware from the global registry.
-
runWithoutMiddleware(
void action()) → void -
Bypasses all middlewares for the duration of
action.