If you are building a custom surface API, start with docs/guide.md for the
step-by-step preset and system workflows.
Always retain and stop effects you create in long-lived contexts.
final stop = effect(() => print(count()));
// later
stop();Use scopes when multiple effects should stop together.
final scope = effectScope(() {
effect(() => print('one ${count()}'));
effect(() => print('two ${count()}'));
});
// later
scope();Batch writes to avoid redundant effect runs.
startBatch();
count.set(1);
count.set(2);
endBatch();Prefer computed for derived values; it caches and reuses results.
final total = computed((prev) => price() * qty());Use trigger to notify dependents without creating a long-lived effect.
trigger(() {
count();
});- Keep tests focused and deterministic.
- Use
dart testto run the suite. - Name tests after behavior (for example,
computed_test.dart).