call method
- void action(), {
- bool guard()?,
- int? take,
- void onUncaughtError(
- Object error,
- StackTrace stackTrace
Defines an explicit manifest Effect attached to this node.
-
Skips initial evaluation (0 runs upon construction/mount).
-
Executes
actionin an untracked environment when this node mutates. -
If
guardis provided and returnsfalse, execution is skipped andtaketickets are preserved. -
If
takeis provided, executes at mosttaketimes then automatically deactivates (Early Teardown). -
If
onUncaughtErroris provided, it is invoked when an uncaught exception is thrown inactionorguard. -
action: The untracked callback to invoke upon mutation. -
guard: Optional boolean predicate gating execution and preserving tickets whenfalse. -
take: Optional limit on execution count before automatic deactivation. -
onUncaughtError: Optional error recovery handler.
Requires:
- If
takeis provided, it must be greater than or equal to0.
Ensures:
- Returns a unary manifest Effect bound to this node.
Examples
final counter = blooming(0);
final effect = counter.bloom.effect(() {
analyticsService.logCounter(untracked(counter.bloom));
});
Implementation
@pragma('vm:prefer-inline')
Effect call(
void Function() action, {
bool Function()? guard,
int? take,
void Function(Object error, StackTrace stackTrace)? onUncaughtError,
}) =>
Effect.unary(
_target,
action,
guard: guard,
take: take,
onUncaughtError: onUncaughtError,
);