jolt library
Jolt - A reactive system for Dart and Flutter.
Basic Usage
import 'package:jolt/jolt.dart';
void main() {
// Create reactive state
final count = Signal(0);
final doubled = Computed(() => count.value * 2);
// React to changes
Effect(() {
print('Count: ${count.value}, Doubled: ${doubled.value}');
});
count.value = 5; // Prints: "Count: 5, Doubled: 10"
}
Classes
-
AsyncData<
T> - Represents the success state of an async operation with data.
-
AsyncError<
T> - Represents the error state of an async operation.
-
AsyncLoading<
T> - Represents the loading state of an async operation.
-
AsyncRefreshing<
T> - Represents the refreshing state of an async operation.
-
AsyncSignal<
T> - A reactive signal that manages async state transitions.
-
AsyncSource<
T> - Abstract interface for async data sources.
-
AsyncState<
T> - Represents the state of an asynchronous operation.
-
Computed<
T> - A computed value that automatically updates when its dependencies change.
- Effect
- A reactive effect that automatically runs when its dependencies change.
- EffectBaseNode
- Base class for all effect nodes in the reactive system.
- EffectScope
- A scope for managing the lifecycle of effects and other reactive nodes.
-
FutureSignal<
T> - A specialized async signal for Future-based operations.
-
FutureSource<
T> - An async source that wraps a Future.
-
IMutableCollection<
T> - Marker interface for mutable collection types.
-
IterableSignal<
E> - A reactive iterable that computes its value from a getter function.
- JEffectNode
- Interface for reactive nodes that can execute effect functions.
-
JReadonlyValue<
T> - Base class for all readable reactive values.
-
JWritableValue<
T> - Interface for writable reactive values.
-
ListSignal<
E> - A reactive list that automatically notifies subscribers when modified.
-
MapSignal<
K, V> - A reactive map that automatically notifies subscribers when modified.
-
ReadonlySignal<
T> - A read-only interface for signals that prevents modification.
-
SetSignal<
E> - A reactive set that automatically notifies subscribers when modified.
-
Signal<
T> - A reactive signal that holds a value and notifies subscribers when it changes.
-
StreamSignal<
T> - A specialized async signal for Stream-based operations.
-
StreamSource<
T> - An async source that wraps a Stream.
-
Watcher<
T> - A watcher that observes changes to reactive sources and executes a callback.
-
WritableComputed<
T> - A writable computed value that can be both read and written.
-
WritableSignal<
T> - A writable interface for signals that allows modification.
Enums
- DebugNodeOperationType
- Types of operations that can be debugged in the reactive system.
Mixins
-
IterableSignalMixin<
E> - A mixin that provides reactive iterable functionality.
-
ListSignalMixin<
E> - A mixin that provides reactive list functionality.
-
MapSignalMixin<
K, V> - A mixin that provides reactive map functionality.
-
SetSignalMixin<
E> - A mixin that provides reactive set functionality.
Extensions
-
JoltFutureExtension
on Future<
T> - Extension methods for converting Future to reactive AsyncSignal.
-
JoltIterableExtension
on Iterable<
E> - Extension methods for converting Iterable to reactive IterableSignal.
-
JoltListExtension
on List<
E> - Extension methods for converting List to reactive ListSignal.
-
JoltMapExtension
on Map<
K, V> - Extension methods for converting Map to reactive MapSignal.
- JoltObjectExtension on T
- Extension methods for converting any object to a reactive signal.
-
JoltSetExtension
on Set<
E> - Extension methods for converting Set to reactive SetSignal.
-
JoltSignalExtension
on Signal<
T> - Extension methods for Signal to provide additional functionality.
-
JoltStreamExtension
on Stream<
T> - Extension methods for converting Stream to reactive StreamSignal.
-
JoltStreamValueExtension
on JReadonlyValue<
T> - Extension methods for converting reactive values to streams.
-
JoltWritableComputedExtension
on WritableComputed<
T> - Extension methods for WritableComputed to provide additional functionality.
Functions
Typedefs
- JoltDebugFn = void Function(DebugNodeOperationType type, ReactiveNode node)
- Function type for debugging reactive system operations.
-
SourcesFn<
T> = T Function() - Function type for providing source values to a watcher.
-
WatcherFn<
T> = FutureOr< void> Function(T newValue, T oldValue) - Function type for handling watcher value changes.
-
WhenFn<
T> = bool Function(T newValue, T oldValue) - Function type for determining when a watcher should trigger.