delete static method

Future<Map<String, dynamic>> delete({
  1. required String collection,
  2. required String id,
})

deletes a object with id at collection

Implementation

static Future<Map<String, dynamic>> delete({
  required String collection,
  required String id,
}) async {
  final path = collection + "/$id";
  final response = await Strapi.i.request(
    path,
    method: "DELETE",
  );
  if (response.failed) {
    throw StrapiResponseException(
      "failed to delete at collection $collection for id :$id",
      response,
    );
  }
  return response.body.isNotEmpty ? response.body.first : {};
}