PositiveIntegerValidationController constructor

PositiveIntegerValidationController({
  1. String message = 'Text must be an integer positive number',
  2. bool required = false,
})

Implementation

PositiveIntegerValidationController(
    {String message = 'Text must be an integer positive number',
    bool required = false})
    : super(
          message: message,
          isValid: ({controller}) {
            String? textValue = controller?.rawValue?.toString();
            if (!required && TextUtils.isEmpty(textValue)) return true;
            int? value = int.tryParse(textValue!);
            return (value ?? -1) >= 0;
          });