findMax static method
this method can find the max intordouble from dynamic list list
example:
print(AdvanceMath.findMaxInt(list:[1,2,4,5,6,10,10,21])); // 21
print(AdvanceMath.findMaxInt(list:['daw',12.2,11,2])); // 12.2
Implementation
static dynamic findMax({required List list}) {
List tosort = [0];
list.forEach((element) {
if (element is double || element is int) {
tosort.add(element);
}
});
tosort.sort();
return tosort.last;
}