ComputedField.first constructor
ComputedField.first(})
Create a FIRST (single value) computed field.
Fetches the first matching value with optional ordering.
ComputedField.first('priceCurrency',
from: 'Plan',
where: {'consultantId': FieldRef('id')},
orderBy: {'price': 'asc'})
// Generates: (SELECT "priceCurrency" FROM "Plan" WHERE ... ORDER BY "price" ASC LIMIT 1)
Implementation
factory ComputedField.first(
String field, {
required String from,
Map<String, dynamic>? where,
Map<String, String>? orderBy,
}) {
return ComputedField._(
field: field,
operation: AggregateOp.first,
from: from,
where: where,
orderBy: orderBy,
);
}