count method

Expression<int> count({
  1. bool distinct = false,
  2. Expression<bool>? filter,
})

Returns how often this expression is non-null in the current group.

For COUNT(*), which would count all rows, see countAll.

If distinct is set (defaults to false), duplicate values will not be counted twice. To only consider rows matching a predicate, you can set the optional filter. Note that filter is only available from sqlite 3.30, released on 2019-10-04. Most devices will use an older sqlite version.

Implementation

Expression<int> count({bool distinct = false, Expression<bool>? filter}) {
  return AggregateFunctionExpression('COUNT', [this],
      filter: filter, distinct: distinct);
}