sortedBy method

DataFrame sortedBy(
  1. String colName, {
  2. bool ascending = true,
  3. bool nullsFirst = true,
  4. Comparator<Record?>? compareRecords,
})

Returns a new dataframe sorted by the column colName.

By default, rows are ordered by plugging pairs of records into Comparable.compare whilst taking ascending and nullsFirst into account.

To customize sorting, pass a custom compareRecords function, in which case ascending and nullsFirst will be ignored.

sortedBy does not guarantee a stable sort order.

Implementation

DataFrame sortedBy(String colName,
        {bool ascending = true,
        bool nullsFirst = true,
        Comparator<Record>? compareRecords}) =>
    _copied(
      _trackedColumnNames,
      _sort(colName,
          inPlace: false,
          ascending: ascending,
          nullsFirst: nullsFirst,
          compareRecords: compareRecords),
    );