deleteObject method

Future<void> deleteObject({
  1. required String bucket,
  2. required String key,
  3. String? region,
  4. Map<String, String>? headers,
  5. Map<String, String>? params,
})

Implementation

Future<void> deleteObject({
  required String bucket,
  required String key,
  String? region,
  Map<String, String>? headers,
  Map<String, String>? params,
}) async {
  return send(COSFetchConfig(
      bucket: bucket,
      key: key,
      method: 'DELETE',
      region: region,
      headers: headers,
      params: params,
      resHandlers: [
        (fetchContext, data) async {
          final res = fetchContext.res;

          if (res?.statusCode != HttpStatus.noContent) {
            throw await COSException.fromResponse(res);
          }
        }
      ]));
}