call method

  1. @override
bool call(
  1. Object? object, {
  2. covariant C? cell,
  3. dynamic arguments,
  4. bool exception(
    1. TestRule<dynamic, Cell> rule,
    2. Exception e
    ) = TestRuleTrue.passed,
})

Validates an operation on the collective.

Parameters:

  • object: The object being validated (either an element or action)
  • cell: The collective being operated on
  • arguments: Additional arguments for the operation
  • exception: Exception handler for validation failures

Returns true if the operation is allowed, false otherwise.

Implementation

@override
bool call(object, {covariant C? cell, arguments, bool Function(TestRule rule, Exception e) exception = TestRuleTrue.passed}) {

  try {
    if (cell != null && object is E && (arguments == null || arguments is Function)) {
      return element(object, cell, action: arguments);
    }
    return super.call(object, cell: cell, arguments: arguments, exception: exception);
  } on Exception catch(e) {
    if (exception(this, e) == false) {
      return false;
    }
  }

  return true;
}