isValid method

  1. @override
bool isValid(
  1. double instance
)
override

Tells whether the instance is valid.

Implementation

@override
bool isValid(double instance) {
  {
    final min = this.min;
    if (min != null) {
      if (isExclusiveMin) {
        if (instance <= min) {
          return false;
        }
      } else {
        if (instance < min) {
          return false;
        }
      }
    }
  }
  {
    final max = this.max;
    if (max != null) {
      if (isExclusiveMax) {
        if (instance >= max) {
          return false;
        }
      } else {
        if (instance > max) {
          return false;
        }
      }
    }
  }
  return super.isValid(instance);
}