forceInRange method

  1. @useResult
num forceInRange(
  1. num min,
  2. num max
)

Returns the min if the number is less than min, max if greater than max, or the number itself otherwise. Audited: 2026-06-12 11:26 EDT

Implementation

@useResult
num forceInRange(num min, final num max) => this < min ? min : (this > max ? max : this);