IntegerRangeValidationController constructor
IntegerRangeValidationController({})
Implementation
IntegerRangeValidationController(
{int? minValue,
int? maxValue,
String message = 'Number must fall in the specified range',
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 ?? 0) >= (minValue ?? 0) &&
(value ?? 0) <= (maxValue ?? 0);
});