orderBy method

QueryReference orderBy(
  1. String fieldPath, {
  2. bool descending = false,
})

Returns QueryReference that's additionally sorted by the specified fieldPath.

The field is a String representing a single field name. After a QueryReference order by call, you cannot add any more orderBy calls.

Implementation

QueryReference orderBy(
  String fieldPath, {
  bool descending = false,
}) {
  final order = StructuredQuery_Order();
  order.field_1 = StructuredQuery_FieldReference()..fieldPath = fieldPath;
  order.direction = descending
      ? StructuredQuery_Direction.DESCENDING
      : StructuredQuery_Direction.ASCENDING;
  _structuredQuery.orderBy.add(order);
  return this;
}