Object-shaped reactive primitives for Dart and Flutter, built on alien_signals.
This is the core-only Oref 3 development API, not a published stable release. It replaces the old 2.x implementation rather than providing a compatibility layer. Flutter integration and upper-level state APIs are not implemented yet. See design issue #47.
import 'package:oref/oref.dart';
final count = Signal(0);
final doubled = Computed(() => count.value * 2);
Readable<int> value = doubled;
final scope = ReactiveScope();
scope.run(() {
Effect((onCleanup) {
print(value.value);
onCleanup(() => print('Clean up this run'));
});
});
batch(() {
count.value = 1;
count.value = 2;
});
print(untracked(() => doubled.value));
scope.dispose();Readable<T>exposes a tracked.valuegetter.Signal<T>adds a.valuesetter; comparison follows upstreamidentical.Computed<T>is lazy and cached.Computed.withPreviousexposes the last successful value when needed.Effectruns synchronously on creation, then on dependency changes.onCleanupregistrations run in reverse order before reruns and disposal.ReactiveScope.rungroups synchronously created effects and nested scopes. The scope itself does not reactively rerun.batchanduntrackedare synchronous boundaries, not async transactions.
Tracking, caching, propagation, and the effect queue remain in alien_signals.
There is no custom notification API, second graph, independent owner context,
or Zone-based error policy. Read the core guide
for cleanup errors, setup failure, nesting, and await boundaries.
Requires Dart 3.13+. To work with this unpublished version, use this checkout as a local path dependency or run its example directly:
dart pub get
dart analyze
dart test
dart run example/oref_example.dartThe old hooks, collection wrappers, async utilities, Flutter adapters, analyzer plugin, and DevTools extension have been removed. No replacement resource APIs or widget builders are included in this core implementation.
MIT. See LICENSE.