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
Assuming the list is not empty you can use Iterable.reduce :
import 'dart:math'; main(){ print([1,2,8,6].reduce(max)); // 8 print([1,2,8,6].reduce(min)); // 1 }