TestObjectRule<C extends Cell> class abstract interface

An abstract interface for creating test rules that validate arbitrary objects within a Cell context.

This serves as the base interface for rules that validate objects of any type, providing factory constructors for common rule creation patterns. It combines the functionality of TestRule with additional convenience methods for rule composition and function-based validation.

Implementations should handle:

  • Validation of objects against custom criteria
  • Exception handling during validation
  • Composition with other rules
  • Conversion from function-based validators

Example usage:

// Create from single function
final rule1 = TestObjectRule(rule: (obj) => obj.isValid);

// Create from multiple functions
final rule2 = TestObjectRule.fromRules(
  functions: [check1, check2],
  user: context
);
Implemented types
Implementers

Constructors

TestObjectRule.new({required Function rule, dynamic user})
factory
TestObjectRule.fromRules({required Iterable<Function> functions, dynamic user})
factory

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? cell, dynamic arguments, bool exception(TestRule<dynamic, Cell> rule, Exception e) = TestRuleTrue.passed}) bool
Executes the rule's validation logic.
inherited
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.
inherited
operator ==(Object other) bool
The equality operator.
inherited