reversed property

SortOrder<T> get reversed

Creates a reversed version of this sort order.

Implementation

SortOrder<T> get reversed {
  if (_comparator != null) {
    return SortOrder<T>(
      id: id,
      label: label,
      comparator: (a, b) => -_comparator(a, b),
    );
  }

  if (_fieldSelector != null) {
    return SortOrder<T>.byField(
      id: id,
      label: label,
      fieldSelector: _fieldSelector,
      direction: _direction == SortDirection.ascending
          ? SortDirection.descending
          : SortDirection.ascending,
    );
  }

  return this;
}