ComputedField.count constructor

ComputedField.count({
  1. String field = '*',
  2. required String from,
  3. Map<String, dynamic>? where,
})

Create a COUNT aggregate computed field.

By default counts all rows (COUNT(*)). Optionally specify a field to count non-null values of that field (COUNT(field)).

// COUNT(*) - count all rows
ComputedField.count(from: 'Review', where: {...})

// COUNT(field) - count non-null values
ComputedField.count(field: 'rating', from: 'Review', where: {...})

Implementation

factory ComputedField.count({
  String field = '*',
  required String from,
  Map<String, dynamic>? where,
}) {
  return ComputedField._(
    field: field,
    operation: AggregateOp.count,
    from: from,
    where: where,
  );
}