count method

Future<int> count({
  1. required String category,
  2. Map<String, dynamic>? tagFilter,
})

Counts the records matching a category and tag filter.

Throws an AskarSessionException if the session is closed. Returns the count of matching records.

Implementation

Future<int> count({required String category, Map<String, dynamic>? tagFilter}) async {
  _throwOnNullHandle("Cannot count from closed session");

  try {
    final result = await askarSessionCount(handle!, category, tagFilter: tagFilter);
    return result.getValueOrException();
  } catch (e) {
    throw AskarSessionException('Error on session count: $e');
  }
}