clamped method
Clamps this integer between min and max.
Returns a value that is at least min and at most max.
Example:
int value = 150;
value = value.clamped(min: 0, max: 100); // 100
Implementation
int clamped({required int min, required int max}) {
if (this < min) return min;
if (this > max) return max;
return this;
}