Version:
7.0.0
Installation#
flutter pub add signals_hooks
The signals_hooks package provides seamless, type-safe bindings for the highly popular flutter_hooks
package. It enables developers to declare, instantiate, and automatically clean up reactive signals directly inside hook-based functional widgets.
Key Features#
-
🎣 Hook-based Signalling: Instantly declare state with
useSignal()inside functional Hook widgets. - 🌀 Automatic Disposal: No manual cleanup or dispose overrides required; the hook manages the entire signal life cycle.
- ⚡ useComputed & useAsyncComputed: Create cacheable hook-scoped computations and fetch async states inside your Hook widgets.
Quick Start#
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:signals/signals_hooks.dart';
class HookCounter extends HookWidget {
const HookCounter({super.key});
@override
Widget build(BuildContext context) {
// Creates a signal tied to the widget life cycle
final count = useSignal(0);
return ElevatedButton(
onPressed: () => count.value++,
child: Text('Count: ${count.value}'),
);
}
}
Package Contents#
Widgets
Hooks
useAsyncComputed
useAsyncSignal
useChangeStackSignal
useComputed
useConnect
useExistingSignal
useFutureSignal
useIterableSignal
useLazySignal
useLinkedSignal
useListSignal
useMapSignal
useQueueSignal
useSetSignal
useSignal
useSignalEffect
useSignalValue
useStreamSignal
useTrackedSignal
useValueListenableToSignal
useValueNotifierToSignal