TestRule<O, C extends Cell> class abstract interface

An interface for defining validation rules that can be applied to objects in a reactive cell system.

TestRules encapsulate validation logic that determines whether operations should be allowed on cells and their contents. Rules can be combined to create complex validation scenarios.

Rules are used throughout the cell system to:

  • Validate signal propagation
  • Authorize cell modifications
  • Control element operations in collectives
  • Enforce business logic constraints

Implementations should override the call() method to provide validation logic.

Example:

class PositiveNumberRule implements TestRule<num, MyCell> {
  const PositiveNumberRule();

  @override
  bool call(num object, {MyCell? cell, dynamic arguments}) {
    return object > 0;
  }
}

Example usage:

const myRule = TestRuleTrue(); // Default always-true rule
final combined = myRule + otherRule; // Rule composition
final isValid = myRule(someObject, cell: contextCell);

Type parameters:

  • O: The type of objects this rule validates
  • C: The type of cell this rule operates with (must extend Cell)
Implementers

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(O object, {C? cell, dynamic arguments, bool exception(TestRule<dynamic, Cell> rule, Exception e) = TestRuleTrue.passed}) bool
Executes the rule's validation logic.
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 +(TestRule<dynamic, Cell> other) TestObject<C>
Combines this rule with another rule to create a composite validation.
operator ==(Object other) bool
The equality operator.
inherited