isBetween method

bool isBetween(
  1. num first,
  2. num second
)

Checks if the current value falls between the specified range.

Returns true if the current value is between first and second, otherwise returns false.

Example:

bool isInRange = 100.0.isBetween(50.0, 150.0);
print('Is in range? $isInRange'); // Output: true

Implementation

bool isBetween(num first, num second) {
  final lower = math.min(first, second);
  final upper = math.max(first, second);
  return validate() >= lower && validate() <= upper;
}