alien_signals 1.0.0-beta.2
alien_signals: ^1.0.0-beta.2 copied to clipboard
The lightest signal library - Dart implementation of alien-signals.
[assets/logo.png]
Alien Signals for Dart #
The lightest signal library for Dart, ported from stackblitz/alien-signals.
Tip
alien_signals
is the fastest signal library currently, as shown by experimental results from 👉 dart-reactivity-benchmark.
Installation #
To install Alien Signals, add the following to your pubspec.yaml
:
dependencies:
alien_signals: 1.0
Alternatively, you can run the following command:
dart pub add alien_signals
Adoption #
- Solidart - ❤️ Signals in Dart and Flutter, inspired by SolidJS
- Oref - 🪄 A reactive state management library for Flutter that adds magic to any Widget with signals
Basic Usage #
import 'package:alien_signals/alien_signals.dart';
void main() {
// Create a signal
final count = signal(0);
// Create a computed value
final doubled = computed((_) => count.value * 2);
// Create an effect
effect(() {
print('Count: ${count()}, Doubled: ${doubled.value}');
});
// Update the signal
count.value++; // Prints: Count: 1, Doubled: 2
}
API Reference #
See the API documentation for detailed information about all available APIs.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Credits #
This is a Dart port of the excellent stackblitz/alien-signals library.