Skip to content

vowdemon/jolt

Repository files navigation

Jolt

CI/CD codecov jolt jolt_flutter jolt_setup jolt_hooks jolt_surge jolt_lint License: MIT

Reactive state management for Dart and Flutter using signals, computed values, effects, and reactive collections. Built on alien_signals.

Documentation

Official Documentation

Packages

The Jolt ecosystem consists of six packages:

jolt - Core Library

The foundation of Jolt, providing reactive primitives for Dart and Flutter:

  • Signal<T> - Reactive state containers
  • Computed<T> - Automatically computed derived values
  • Effect - Side-effect functions
  • AsyncSignal<T> - Async state management
  • Reactive collections: ListSignal, MapSignal, SetSignal, IterableSignal

jolt_flutter - Flutter Integration

Flutter-specific widgets and utilities for reactive UI:

  • JoltBuilder - Automatic reactive UI updates
  • JoltSelector - Fine-grained selector updates
  • JoltValueNotifier - Integration with Flutter's ValueNotifier system

jolt_setup - Setup Widget & Composition API

Composition API similar to Vue's Composition API for Flutter, with automatic resource management:

  • SetupWidget - Composition-based widget with setup() function
  • SetupMixin - Add composition API to existing StatefulWidgets
  • SetupBuilder - Inline composition API for quick prototyping
  • Automatic resource cleanup - No manual dispose() needed
  • Hook APIs for controllers, focus nodes, animations, lifecycle, and more

jolt_hooks - Flutter Hooks Integration

Integration with flutter_hooks for using Jolt primitives in HookWidget:

  • useSignal() - Create reactive signals in hooks
  • useComputed() - Computed values that rebuild on changes
  • useJoltEffect() - Side effects with automatic cleanup
  • useJoltWidget() - Fine-grained reactive widgets
  • Collection variants: useSignal.list(), useSignal.map(), useSignal.set()
  • HookWidget-compatible API that runs on every build

jolt_surge - Signal-Powered Cubit Pattern

A state management pattern inspired by BLoC's Cubit, powered by Jolt Signals:

  • Surge<State> - Reactive state container similar to Cubit
  • SurgeProvider - Provides Surge instances to the widget tree
  • SurgeConsumer - Unified widget for both building UI and handling side effects
  • SurgeBuilder, SurgeListener, SurgeSelector - Convenience widgets

jolt_lint - Lint & Code Assists

Custom lint rules and code assists for the Jolt ecosystem:

  • Hook Rules Enforcement - Ensures hooks are only called in setup or other hooks
  • Code Assists - Quick fixes for converting between patterns, wrapping widgets
  • Compile-time Safety - Catches async/callback hook usage before runtime
  • IDE Integration - Real-time feedback and automatic fixes in your editor
  • Pattern Validation - Enforces best practices for Setup Widget and reactive patterns

Quick Start

import 'package:jolt/jolt.dart';

void main() {
  final count = Signal(0);
  final doubled = Computed(() => count.value * 2);
  
  Effect(() {
    print('Count: ${count.value}, Doubled: ${doubled.value}');
  });
  
  count.value = 5; // Prints: "Count: 5, Doubled: 10"
}

Related Links

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A lightweight reactive state management library built on alien_signals, focused on simple and efficient state handling.

Resources

License

Stars

Watchers

Forks

Contributors

Languages