findMultiple static method
returns all objects in a collection, run get query against a collection
, limit the number of objects in the response by setting limit
,
throws StrapiResponseException if response is failed
Implementation
static Future<List<Map<String, dynamic>>> findMultiple({
required String collection,
int? limit,
}) async {
final response = await Strapi.i
.request(collection, params: {if (limit is int) "_limit": "$limit"});
if (response.failed) {
throw StrapiResponseException(
"failed to get multiple objects from collection $collection",
response,
);
}
if (!response.failed) {
StrapiObjectListener._inform(response.body);
}
return response.body;
}