from<N extends num> static method

ScaleNum<num>? from<N extends num>(
  1. Iterable<N>? list
)
override

Implementation

static ScaleNum? from<N extends num>(Iterable<N>? list) {
  if (list == null || list.isEmpty) return null;

  num min = list.first;
  var max = min;

  for (var n in list) {
    if (n < min) {
      min = n;
    }

    if (n > max) {
      max = n;
    }
  }

  return ScaleNum(min, max);
}