jolt_flutter library

A Flutter integration package for Jolt reactive state management.

This package provides Flutter-specific widgets and utilities for working with Jolt signals, computed values, and reactive state. It includes widgets like JoltBuilder for reactive UI updates and seamless integration with Flutter's ValueNotifier system.

Documentation

Official Documentation

Example

import 'package:jolt_flutter/jolt_flutter.dart';

final counter = Signal(0);

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return JoltBuilder(
      builder: (context) => Text('Count: ${counter.value}'),
    );
  }
}

Classes

AsyncError<T>
Represents the error state of an async operation.
AsyncLoading<T>
Represents the loading state of an async operation.
AsyncSignal<T>
Interface for reactive signals that manage async state transitions.
AsyncSource<T>
Abstract interface for async data sources.
AsyncState<T>
Represents the state of an asynchronous operation.
AsyncSuccess<T>
Represents the success state of an async operation with data.
Computed<T>
Interface for computed reactive values.
DisposableNode
Effect
Interface for reactive effects that run when dependencies change.
EffectNode
Interface for effect nodes (Effect, EffectScope, Watcher).
EffectScope
Interface for effect scopes that manage the lifecycle of effects.
FlutterEffect
Interface for Flutter effects that schedule execution at frame end.
FutureSource<T>
An async source that wraps a Future.
IMutableCollection<T>
Marker interface for mutable collection types.
IterableSignal<E>
Interface for reactive iterable signals.
JoltBuilder
A widget that automatically rebuilds when any signal accessed in its builder changes.
JoltBuilderElement
Element for JoltBuilder that manages reactive rebuilds.
JoltSelector<T>
A widget that rebuilds only when a specific selector function's result changes.
JoltSelectorElement<T>
Element for JoltSelector that manages selective rebuilds.
JoltValueListenable<T>
A ValueListenable that wraps a Jolt Readable value.
JoltValueNotifier<T>
A ValueNotifier that wraps a Jolt Writable value.
JoltWatchBuilder<T>
A widget that automatically rebuilds when a Readable value changes.
JoltWatchBuilderElement
Element for JoltWatchBuilder that manages reactive rebuilds.
ListSignal<E>
Interface for reactive list signals.
MapSignal<K, V>
Interface for reactive map signals.
ReadableNode<T>
Interface for readonly reactive nodes.
ReadonlySignal<T>
A read-only interface for signals that prevents modification.
SetSignal<E>
Interface for reactive set signals.
Signal<T>
A writable interface for signals that allows modification.
StreamSource<T>
An async source that wraps a Stream.
ValueListenableSignal<T>
A read-only Signal wrapping a ValueListenable.
ValueNotifierSignal<T>
A writable Signal wrapping a ValueNotifier with bidirectional sync.
Watcher<T>
Interface for watchers that observe changes to reactive sources.
WritableComputed<T>
Interface for writable computed reactive values.
WritableNode<T>
Interface for writable reactive nodes.

Enums

DebugNodeOperationType
Types of operations that can be debugged in the reactive system.

Mixins

EffectCleanupMixin
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.

Functions

batch<T>(T fn()) → T
Batches multiple reactive updates into a single notification cycle.
notifyAll<T>(T fn()) → T
Executes a function and notifies all dependencies of changes.
onEffectCleanup(Disposer fn, {EffectCleanupMixin? owner}) → void
Registers a cleanup function to be executed when the current effect is disposed or re-run.
onScopeDispose(Disposer fn, {EffectScope? owner}) → void
Registers a cleanup function to be executed when the current effect scope is disposed.
trackWithEffect<T>(T fn(), EffectNode sub, [bool purge = true]) → T
Executes a function with a specific effect node as the active subscriber.
untracked<T>(T fn()) → T
Executes a function without tracking reactive dependencies.

Typedefs

JoltDebugFn = void Function(DebugNodeOperationType type, ReactiveNode node, Link? link)
Function type for debugging reactive system operations.
SourcesFn<T> = T Function()
Function type for providing source values to a watcher.
WatcherFn<T> = 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.