ApplyVeto class
A special signal used by a function to cancel its own operation.
ApplyVeto is a "soft-reject" convention. Sometimes, a function is allowed to run by the safety rules (the Integrity Gate), but once it starts, it discovers a reason why it shouldn't finish. By returning ApplyVeto.instance, the function tells the framework to stop and treat the action as a rejection.
In the framework's biological metaphor, this is a Self-Regulating Signal where a cell decides to suppress its own mutation after receiving an impulse.
Why it is used
- Internal Decisions: Use this when the logic to reject a change can only be determined inside the function body, rather than by an external safety gate.
- Clear Intent: It is better than returning
nullorfalse, because it explicitly tells the framework: "I am choosing to cancel this specific action." - Transaction Safety: When a function returns a veto, the framework treats it as a failure, ensuring that any related changes in a transaction are handled correctly.
How it works
You do not create new versions of this class. Instead, you return the shared ApplyVeto.instance. The framework's execution layer checks for this specific object; if found, it converts the result into an ApplyRejected outcome.
Best Practices
- Prefer Gates: If you know a command should be rejected before it runs, use an Integrity Gate (TestCell.action) instead.
- Avoid Exceptions: Use a veto when a rejection is a normal part
of your business logic. Use
throwonly for unexpected system errors.
See also:
- ApplyRejected — The outcome produced when a function returns a veto.
- Cell.modifiable — Where functions that might return a veto are registered.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited