NumericExtents.fromValues constructor
Returns Extents
based on the min and max of the given values.
Returns NumericExtents.empty if values
are empty
Implementation
factory NumericExtents.fromValues(Iterable<num> values) {
if (values.isEmpty) {
return NumericExtents.empty;
}
var min = values.first;
var max = values.first;
for (final value in values) {
if (value < min) {
min = value;
} else if (max < value) {
max = value;
}
}
return NumericExtents(min, max);
}