isInRange method
Checks if the BigInt value is within the specified range.
Determines if this BigInt is between min and max.
- If
inclusiveistrue, the range is inclusive, meaning the method returnstrueif the value is equal tominormax. - If
inclusiveisfalse, the range is exclusive, meaning the method returnstrueonly if the value is strictly betweenminandmax.
Parameters:
min: The lower bound of the range.max: The upper bound of the range.inclusive: A boolean indicating whether the range is inclusive. Defaults totrue.
Returns:
trueif the BigInt is within the specified range, according to theinclusiveflag.falseotherwise.
Implementation
bool isInRange(BigInt min, BigInt max, {bool inclusive = true}) {
assert(min <= max);
if (inclusive) {
return this >= min && this <= max;
} else {
return this > min && this < max;
}
}