isBetween method

bool isBetween(
  1. int min,
  2. int max
)

Returns true if the number is between min and max (inclusive).

Example:

5.isBetween(1, 10); // true
5.isBetween(10, 20); // false

Implementation

bool isBetween(int min, int max) {
  assert(min <= max, 'min must be less than or equal to max');
  return this >= min && this <= max;
}