queryOrderFrom function
Reads a query's orderBy ({field, direction}, direction ascending
or descending). Throws FormatException for any other shape.
Implementation
List<QueryOrder> queryOrderFrom(Iterable<Object?> orderBy) => [
for (final key in orderBy)
switch (key) {
{'field': final String field, 'direction': 'ascending'} => (
field: field,
descending: false,
),
{'field': final String field, 'direction': 'descending'} => (
field: field,
descending: true,
),
_ => throw FormatException('An orderBy key this device cannot run: $key'),
},
];