count static method

Future<int> count(
  1. String collection
)

count the objects in the collection, throws StrapiResponseException if response is failed

Implementation

static Future<int> count(String collection) async {
  final path = collection + "/count";
  final response = await Strapi.i.request(
    path,
  );
  if (response.failed) {
    throw StrapiResponseException(
        "failed to count at collection $collection", response);
  }
  return response.count;
}