SortDescriptor class final

Represents a sorting rule applied to a health record query.

Combines a SortField (what to sort by) with a SortDirection (ascending or descending order).

Example

// Sort by time, newest first (default)
final request = ReadRecordsInTimeRangeRequest(
  dataType: HealthDataType.steps,
  startTime: startTime,
  endTime: endTime,
  sortDescriptor: SortDescriptor.timeDescending,
);

// Sort by time, oldest first
final request = ReadRecordsInTimeRangeRequest(
  dataType: HealthDataType.steps,
  startTime: startTime,
  endTime: endTime,
  sortDescriptor: SortDescriptor.timeAscending,
);
Annotations

Properties

direction SortDirection
The direction to sort (ascending or descending).
final
field SortField
The field to sort by.
final
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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.
override

Constants

timeAscending → const SortDescriptor
Sort by time in ascending order (oldest first).
timeDescending → const SortDescriptor
Sort by time in descending order (newest first).