isBetween method

bool isBetween(
  1. num min,
  2. num max, {
  3. bool inclusive = true,
})

Checks if this number is between min and max. inclusive determines whether the range includes the endpoints.

Implementation

bool isBetween(num min, num max, {bool inclusive = true}) {
  return inclusive
      ? (this >= min && this <= max)
      : (this > min && this < max);
}