alien_signals 0.2.3 copy "alien_signals: ^0.2.3" to clipboard
alien_signals: ^0.2.3 copied to clipboard

The lightest signal library - Dart implementation of alien-signals.


Alien Signals on pub.dev

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: latest

Alternatively, you can run the following command:

dart pub add alien_signals

Adoption #

Basic Usage #

import 'package:alien_signals/preset.dart';

void main() {
  // Create a signal
  final count = signal(0);

  // Create a computed value
  final doubled = computed((_) => count() * 2);

  // Create an effect
  effect(() {
    print('Count: ${count()}, Doubled: ${doubled()}');
  });

  // Update the signal
  count(1); // Prints: Count: 1, Doubled: 2
}

Creating Your Own Public API #

You can reuse alien_signals core algorithm via ReactiveSystem to build your own signal API. For implementation examples, see:

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.

5
likes
160
points
370
downloads

Publisher

verified publishermedz.dev

Weekly Downloads

The lightest signal library - Dart implementation of alien-signals.

Homepage
Repository (GitHub)
View/report issues

Topics

#signal #signals #reactive #alien-signals #state

Documentation

API reference

Funding

Consider supporting this project:

github.com
opencollective.com

License

MIT (license)

More

Packages that depend on alien_signals