toSafeInt method

int toSafeInt({
  1. int? minValue,
  2. int? maxValue,
})

Implementation

int toSafeInt({
  int? minValue,
  int? maxValue,
}) {
  if (minValue == null && maxValue == null) {
    return toInt();
  }
  if (minValue != null) {
    if (this < minValue) {
      return minValue;
    }
  }
  if (maxValue != null) {
    if (this > maxValue) {
      return maxValue;
    }
  }
  return toInt();
}