positive method

VNumber<T> positive({
  1. String? message,
})

Ensures that the numeric value is positive (greater than 0).

This method adds a PositiveValidator to check whether the value is strictly greater than zero.

Example

final validator = v.num().positive();

print(validator.validate(5));   // true (valid)
print(validator.validate(0));   // false (invalid)
print(validator.validate(-3));  // false (invalid)

Parameters

  • message (optional): A custom validation message.

Returns

The current VNumber<T> instance with the positive validation applied.

Implementation

VNumber<T> positive({String? message}) {
  add(PositiveValidator(message: message!));
  return this;
}