getMax method

int? getMax(
  1. int? collum(
    1. E? element
    ), {
  2. int? defaultValue,
})

Returns max int value in Irarable on collum specified If Iterable is null or empty, return defaultValue

Implementation

int? getMax(int? Function(E? element) collum, {int? defaultValue}) {
  if (this == null || this!.isEmpty) return defaultValue;
  int? max;
  this!.forEach((element) {
    int? pMax = collum(element);
    if (pMax != null) {
      if (max == null || pMax > max!) {
        max = pMax;
      }
    }
  });
  return max;
}