dollar 0.4.0 copy "dollar: ^0.4.0" to clipboard
dollar: ^0.4.0 copied to clipboard

Use $tateful functions everywhere.

dollar #

Build Status

A DSL to keep state in your functions.

Inspired by React hooks.

Usage #

final func = $1((bool input) {
  final a = $value(() => 1);
  $fork(input);
  final b = input ? $value(() => 2) : $value(() => 3);
  $merge();
  a.value++;
  b.value--;
  return [a.value, b.value];
});
expect(func(true), [2, 1]);
expect(func(true), [3, 0]);
expect(func(false), [4, 2]);
expect(func(false), [5, 1]);
expect(func(true), [6, -1]);
expect(func(false), [7, 0]);

See tests for more usages.

0
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Use $tateful functions everywhere.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on dollar