How do you get the min and max values of a List in Dart.
[1, 2, 3, 4, 5].min //returns 1 [1, 2, 3, 4, 5].max //returns 5
For empty lists: This will return 0 if list is empty, the max value otherwise.
List x = [ ]; print(x.isEmpty ? 0 : x.reduce(max)); //prints 0 List x = [1,32,5]; print(x.isEmpty ? 0 : x.reduce(max)); //prints 32