sortBy method

void sortBy(
  1. Comparable getVal(
    1. E e
    )
)

Sorts the list in ascending order of the object's field value.

Implementation

void sortBy(Comparable Function(E e) getVal) =>
    sort((a, b) => getVal(a).compareTo(getVal(b)));