oref 0.5.0 copy "oref: ^0.5.0" to clipboard
oref: ^0.5.0 copied to clipboard

Oref is a lightweight, high-performance reactive programming library.

example/main.dart

import 'package:oref/oref.dart';

void main() {
  final count = ref(0);
  final double = derived(() => count.value * 2);
  final runner = effect(() {
    print('count: ${count.value}, double: ${double.value}');
  }, onStop: () {
    print('effect stopped');
  });

  count.value = 10; // prints 'count: 10, double: 20'
  runner.effect.stop(); // prints 'effect stopped'

  count.value = 20; // nothing

  // Has stopped, but can be manually executed through runner
  runner(); // Call once, prints 'count: 20, double: 40'

  count.value = 30; // nothing
}
1
likes
150
pub points
18%
popularity

Publisher

verified publisherodroe.dev

Oref is a lightweight, high-performance reactive programming library.

Homepage
Repository (GitHub)
View/report issues

Topics

#state #reactive #ref #derived #effect

Documentation

Documentation
API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

More

Packages that depend on oref