validateSingle method

bool validateSingle(
  1. dynamic value
)

Implementation

bool validateSingle(dynamic value) {
  if (value == null) return true;
  var n = value as num;
  if (min != null) {
    if (minExclusive) {
      if (n <= min!) return false;
    } else {
      if (n < min!) return false;
    }
  }

  if (max != null) {
    if (maxExclusive) {
      if (n >= max!) return false;
    } else {
      if (n > max!) return false;
    }
  }

  return true;
}