TestPulseRule<C extends Cell> class
Testing & Validation
A rule that validates incoming Pulse signals before they reach a cell.
Use this to enforce payload schemas, actor permissions, or priority thresholds on pulses.
When to use
When you need to filter or authorize pulses based on their content or metadata – e.g., only accept pulses from trusted sources, or ensure payloads meet business constraints.
How it works
- The rule is attached to a cell via TestCell and evaluated whenever a pulse arrives.
- The
rulefunction receives the pulse, the host cell, and optional user data. - Return
trueto let the pulse through,falseto drop it.
Example
final adminOnly = TestPulseRule<Cell>((pulse, {host, ...}) =>
pulse.context.actor == 'admin');
final highPriority = TestPulseRule<Cell>((pulse, ...) =>
pulse.priority >= 50);
final pulsePolicy = adminOnly + highPriority;
See also:
- TestCell.pulse – the method that orchestrates pulse validation.
- TestLinkRule, TestActionRule – sibling guards for other operations.
Constructors
-
TestPulseRule(bool rule(Pulse pulse, {required C host, dynamic user}), {TestPulseRule<
C> ? parent, dynamic user}) - Creates a pulse validation rule.
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
-
call(
dynamic object, {C? host, dynamic arguments}) → FutureOr< bool> -
Executes the Validation Predicate and orchestrates the
Chain of Responsibility for this rule.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pulse(
covariant Pulse pulse, {required C host}) → FutureOr< bool> -
Executes the pulse validation logic for a specific reactive
pulsetargeting thehostcell, supporting Hybrid Convergence. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator +(
covariant TestRule< C> other) → TestRule<C> -
Composes two TestRule instances into a sequential Validation Pipeline.
inherited
-
operator ==(
Object other) → bool -
The equality operator.
inherited