flutter sorting list code example
Example 1: sort list dart
List nums = [13, 2, -11];
nums.sort();
print(nums); // [-11, 2, 13]
Example 2: sort a custom list flutter
someObjects.sort((a, b) => a.someProperty.compareTo(b.someProperty));
List nums = [13, 2, -11];
nums.sort();
print(nums); // [-11, 2, 13]
someObjects.sort((a, b) => a.someProperty.compareTo(b.someProperty));