isValid method

  1. @override
bool isValid(
  1. Object? value
)
override

Whether value satisfies the constraint; the method a custom constraint implements.

For a property constraint value is the property value (often null: return true for it unless the rule is about presence); for a class-level constraint it is the annotated object itself.

Implementation

@override
bool isValid(Object? value) {
  final sign = _compare(value, _zero);
  return sign == null || sign > 0;
}