sortedByNum method
Returns this as sorted list using the valueProvider
function that produces
numerical values as base for sorting.
Example:
[2, 1, 3].sortedByNum((n) => n); // [1, 2, 3]
persons.sortedByNum((p) => p.age).reversed; // oldest persons first
Implementation
List<T> sortedByNum(num Function(T element) valueProvider) {
ArgumentError.checkNotNull(valueProvider, 'valueProvider');
return sortedBy((a, b) => valueProvider(a).compareTo(valueProvider(b)));
}