normalized method
Normalizes this value from [fromMin, fromMax] into [toMin, toMax].
Implementation
double normalized(
num fromMin,
num fromMax, [
num toMin = 0.0,
num toMax = 1.0,
]) {
final range = fromMax - fromMin;
if (range == 0) {
throw ArgumentError(
'Source range cannot be zero (fromMin == fromMax == $fromMin)',
);
}
return ((toMax - toMin) * ((this - fromMin) / range) + toMin).toDouble();
}