inRange function

bool inRange(
  1. num n,
  2. num start, [
  3. num? end
])

Checks if n is between start and up to, but not including, end. If end is not specified, it's set to start with start then set to 0. If start is greater than end the params are swapped to support negative ranges.

Implementation

bool inRange(num n, num start, [num? end]) {
  if (end == null) {
    end = start;
    start = 0;
  }
  if (start > end) {
    var tmp = start;
    start = end;
    end = tmp;
  }
  return isGreaterEqual(n, start) && isLess(n, end);
}