orderBy method

Query<QueryJsImpl> orderBy(
  1. dynamic fieldPath, [
  2. String? directionStr
])

Creates a new Query where the results are sorted by the specified field, in descending or ascending order.

The fieldPath parameter is a String or FieldPath to sort by.

The optional directionStr parameter is a direction to sort by (asc or desc). If not specified, the default order is ascending.

Returns non-null created Query.

Implementation

Query orderBy(/*String|FieldPath*/ fieldPath,
    [String? /*'desc'|'asc'*/ directionStr]) {
  final jsObjectOrderBy = (directionStr != null)
      ? jsObject.orderBy(fieldPath, directionStr)
      : jsObject.orderBy(fieldPath);
  return Query.fromJsObject(jsObjectOrderBy);
}