jolt_hooks library

Flutter hooks integration for Jolt reactive state.

Built on flutter_hooks. Hooks dispose their reactive resources automatically when the widget unmounts.

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:jolt_hooks/jolt_hooks.dart';

class CounterWidget extends HookWidget {
  @override
  Widget build(BuildContext context) {
    final count = useSignal(0);
    final doubled = useComputed(() => count.value * 2);

    return Scaffold(
      body: HookBuilder(
        builder: (context) => useJoltWidget(() {
          return Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Count: ${count.value}'),
              Text('Doubled: ${doubled.value}'),
              ElevatedButton(
                onPressed: () => count.value++,
                child: Text('Increment'),
              ),
            ],
          );
        }),
      ),
    );
  }
}

Classes

JoltComputedHookCreator
Computed hook factory methods.
JoltEffectHook<S extends Object>
A Hook that wraps a Jolt effect node and disposes it on unmount.
JoltEffectHookCreator
Effect hook factory methods.
JoltEffectHookState<S extends Object>
The HookState for JoltEffectHook.
JoltEffectScopeHookCreator
Effect-scope hook factory methods.
JoltHook<T, S extends Readable<T>>
A Hook that wraps a Jolt Readable and disposes it on unmount.
JoltHookState<T, S extends Readable<T>>
The HookState for JoltHook.
JoltPostFrameEffectHookCreator
Post-frame effect hook factory methods.
JoltSignalHookCreator
Signal hook factory methods.
JoltUntilHook<T>
A Hook that wraps a cancellable Until future.
JoltUntilHookCreator
Until hook factory methods.
JoltUntilHookState<T>
The HookState for JoltUntilHook.
JoltWatcherHookCreator
Watcher hook factory methods.
JoltWidgetHook<T extends Widget>
A Hook that rebuilds a widget when reactive dependencies change.
JoltWidgetHookState<T extends Widget>
The HookState for JoltWidgetHook.

Constants

useComputed → const JoltComputedHookCreator
Creates a Computed value for the current hook scope.
useSignal → const JoltSignalHookCreator
Creates a writable Signal for the current hook scope.

Properties

useEffectScope JoltEffectScopeHookCreator
Creates an EffectScope for the current hook scope.
final
useJoltEffect JoltEffectHookCreator
Creates an Effect for the current hook scope.
final
usePostFrameEffect JoltPostFrameEffectHookCreator
Creates a PostFrameEffect for the current hook scope.
final
useUntil JoltUntilHookCreator
Creates an Until hook that waits for a reactive value to satisfy a condition.
final
useWatcher JoltWatcherHookCreator
Creates a Watcher for the current hook scope.
final

Functions

useJoltStream<T>(Readable<T> value, {List<Object?>? keys}) Stream<T>
Converts a Readable into a Stream for the current hook scope.
useJoltWidget<T extends Widget>(T builder(), {List<Object?>? keys}) → T
Creates a widget that rebuilds when reactive dependencies change.