DecimalRangeValidationController constructor
DecimalRangeValidationController({})
Implementation
DecimalRangeValidationController(
{num? minValue,
num? 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;
num? value = num.tryParse(textValue!);
return (value ?? 0) >= (minValue ?? 0) &&
(value ?? 0) <= (maxValue ?? 0);
});