DecimalRangeValidationController constructor

DecimalRangeValidationController({
  1. num? minValue,
  2. num? maxValue,
  3. String message = 'Number must fall in the specified range',
  4. bool required = false,
})

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);
          });