count method

  1. @override
Future<int> count({
  1. String? userId,
  2. Where? where,
})
override

Returns the number of entries in the repository.

Implementation

@override
Future<int> count({String? userId, Where? where}) async {
  List<Model> data = _getAll();

  if (userId != null) {
    data = data.where((element) => element.userId == userId).toList();
  }

  if (where != null) {
    data = _filter(data, where);
  }

  return data.length;
}