isBetween method

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

Returns if a number is between first and second

100.isBetween(50, 150) // true;
100.isBetween(100, 100) // true;

Implementation

bool isBetween(num first, num second) {
  if (first <= second) {
    return this.validate() >= first && this.validate() <= second;
  } else {
    return this.validate() >= second && this.validate() <= first;
  }
}