between method

bool between(
  1. int min,
  2. int max, {
  3. bool startInclusive = true,
  4. bool endInclusive = true,
})

Implementation

bool between(
  int min,
  int max, {
  bool startInclusive = true,
  bool endInclusive = true,
}) {
  if (this == null) return false;

  if (startInclusive && endInclusive) return this! >= min && this! <= max;
  if (!startInclusive && endInclusive) return this! > min && this! <= max;
  if (startInclusive && !endInclusive) return this! >= min && this! < max;
  if (!startInclusive && !endInclusive) return this! > min && this! < max;

  return false;
}