create static method
create a new object at collection
with the provided data
, returns the object with a id
,
throws StrapiResponseException if response is failed
Implementation
static Future<Map<String, dynamic>> create({
required String collection,
required Map<String, dynamic> data,
}) async {
final path = collection;
final response = await Strapi.i.request(
path,
method: "POST",
body: data,
);
if (response.failed) {
throw StrapiResponseException(
"failed to create object at collection $collection",
response,
);
}
return response.body.first;
}