PageSortOrder class final

Represents a single sorting instruction consisting of:

  • a property (field name),
  • a direction (PageSortDirection),
  • and whether the sort should be case-insensitive.

This class is part of the fluent sorting API used to construct declarative, immutable sort configurations for queries, collections, or persistence frameworks.

Usage Example

// Basic ascending order
final order = SortOrder('username');

// Descending order
final order = SortOrder.desc('createdAt');

// Case-insensitive ordering
final order = SortOrder('email', ignoreCase: true);

// Fluent modification
final reversed = order.reverse();

Behavior Notes

  • property must be non-empty.
  • Defaults to ascending order if no direction is provided.
  • Instances are immutable; transformation methods return new instances.
  • Implements equality through EqualsAndHashCode.

See Also

Mixed-in types

Constructors

PageSortOrder(String property, {PageSortDirection? direction, bool? ignoreCase})
Represents a single sorting instruction consisting of:

Properties

direction → PageSortDirection
The sorting direction (ascending or descending).
final
hashCode → int
The hash code for this object.
no setterinherited
ignoreCase → bool
Whether sorting should be case-insensitive.
final
property → String
The property (field) name to be sorted by.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({PageSortDirection? direction, String? property, bool? ignoreCase}) → PageSortOrder
Creates a new PageSortOrder with the optionally overridden values.
equalizedProperties() → List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reverse() → PageSortOrder
Reverses the sort direction.
toString() → String
A string representation of this object.
override
withDirection(PageSortDirection direction) → PageSortOrder
Returns a copy of this order with the given direction.
withIgnoreCase() → PageSortOrder
Returns a copy of this order with case-insensitive sorting enabled.
withProperties(List<String> properties) → PageSort
Creates a new PageSort using this order’s direction and the given list of properties.
withProperty(String property) → PageSortOrder
Returns a copy of this order with the given property.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

DEFAULT_DIRECTION → PageSortDirection
The default direction used when none is provided: ascending.
final

Static Methods

asc(String property) → PageSortOrder
Creates an ascending sort order for property.
by(String property) → PageSortOrder
Creates a new ascending order for the given property.
desc(String property) → PageSortOrder
Creates a descending sort order for property.