count method

ResponsePostgrestBuilder<PostgrestResponse<T>, T, T> count([
  1. CountOption count = CountOption.exact
])

Performs additionally to the select a count query.

It's used to retrieve the total number of rows that satisfy the query. The value for count respects any filters (e.g. eq, gt), but ignores modifiers (e.g. limit, range).

This changes the return type from the data only to a PostgrestResponse with the data and the count.

final res = await postgrest
   .from('users')
   .select()
   .count(CountOption.exact);
final users = res.data;
int count = res.count;

Implementation

ResponsePostgrestBuilder<PostgrestResponse<T>, T, T> count(
    [CountOption count = CountOption.exact]) {
  return ResponsePostgrestBuilder(
    _copyWithType(count: count),
  );
}