core library

Re-exports the core Jolt reactive system for Flutter integration.

This file provides access to the fundamental Jolt reactive primitives including effects, batching, and the reactive system core. These are the building blocks that power the Flutter-specific widgets and signals.

Core Features

  • Effect system for reactive side effects
  • Batch operations for performance optimization
  • Reactive system lifecycle management
  • Signal dependency tracking

Example

import 'package:jolt_flutter/core.dart';

final counter = Signal(0);

// Create an effect that runs when counter changes
Effect(() {
  print('Counter is now: ${counter.value}');
});

// Batch multiple updates for better performance
batch(() {
  counter.value = 1;
  counter.value = 2;
  counter.value = 3;
}); // Effect only runs once with final value

Classes

JFinalizer
A finalizer utility for managing disposers attached to Jolt objects.
Link between reactive nodes in the dependency graph.
ReactiveFlags
Flags for tracking reactive node state.
ReactiveNode
Base class for all reactive nodes in the dependency graph.
Stack<T>
Stack data structure for managing recursive operations.

Properties

activeScope EffectScope?
getter/setter pair
activeSub ReactiveNode?
The currently active effect or scope
getter/setter pair
batchDepth int
The current batch depth
getter/setter pair
cycle int
The global reactive system The current cycle number
getter/setter pair
notifyIndex int
The effect index in queue
getter/setter pair
queued List<EffectBase?>
The queue of effects to be executed
final
queuedLength int
The length of the queue of effects to be executed
getter/setter pair

Functions

checkDirty(Link theLink, ReactiveNode sub) bool
Checks if a node is dirty and needs updating.
disposeNode(ReactiveNode e) → void
Dispose an effect and clean up its dependencies
endBatch() → void
End a batch update and flush pending effects
flushEffects() → void
Flush all queued effects
getActiveScope() EffectScope?
getActiveSub() ReactiveNode?
getBatchDepth() int
Get the current batch depth
getComputed<T>(Computed<T> computed) → T
Get the current value of a computed, updating if necessary
getSignal<T>(Signal<T> signal) → T
Get a signal's value and track dependencies
Checks if a link is still valid for a subscriber.
Abstract reactive system for managing dependency tracking.
notifyComputed<T>(Computed<T> computed) → void
Force update a computed without changing its value
notifyEffect(JEffect e) → void
Notify a subscriber about changes
notifySignal<T>(ReadonlySignal<T> signal) → void
Force update a signal without changing its value
propagate(Link theLink) → void
Propagates changes through the reactive graph.
purgeDeps(ReactiveNode sub) → void
Purge the dependencies of a reactive node
runEffect(EffectBase e) → void
Run an effect with the given flags
setActiveScope([EffectScope? scope]) EffectScope?
Set the currently active subscriber
setActiveSub([ReactiveNode? sub]) ReactiveNode?
Set the currently active subscriber
setSignal<T>(Signal<T> signal, T newValue) → T
Set a signal's value and trigger updates
shallowPropagate(Link theLink) → void
Shallow propagates changes without deep recursion.
startBatch() → void
Start a batch update to defer effect execution
trigger(void fn()) → void
Notify all dependencies about changes
Unlinks a dependency from a subscriber.
unwatched(dynamic node) → void
Handle cleanup when a node is no longer watched
updateComputed<T>(Computed<T> computed) bool
Update the computed value and return true if changed
updateNode(ReactiveNode node) bool
Update a signal or computed value
updateSignal<T>(Signal<T> signal) bool
Update a signal's value and return true if changed