SortCriterion<T> class
Describes a sorting criterion for use with SearchExtensionMethod.search.
Allows sorting by a field or computed value, in ascending or descending order. Multiple SortCriterions can be combined for multi-level sorting.
Example:
[
SortCriterion((user) => user.lastName),
SortCriterion((user) => user.firstName, ascending: false),
]
Constructors
- SortCriterion(Comparable selector(T item), {bool ascending = true})
-
Creates a SortCriterion with the given
selectorandascendingflag.const
Properties
- ascending → bool
-
Whether to sort in ascending order (default: true).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selector → Comparable Function(T item)
-
Function that extracts a Comparable value from an item for sorting.
final
Methods
-
compare(
T a, T b) → int -
Compares two items
aandbaccording to the selector and order. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited