limitTo method

double limitTo(
  1. double min,
  2. double max
)

returns this if it is between min and max (inclusive) otherwise returns min or max whichever is closer

Implementation

double limitTo(double min, double max) =>
    (this as num)._limitTo(min, max).toDouble();