delete static method

Future<bool> delete(
  1. String filePath,
  2. String bucketName,
  3. String poolID,
  4. _AWSRegion region, {
  5. _AWSRegion? subRegion,
  6. bool debugLog = false,
})

S3 Delete static function requires no instance Returns bool on success

Implementation

static Future<bool> delete(
  String filePath,
  String bucketName,
  String poolID,
  _AWSRegion region, {
  _AWSRegion? subRegion,
  bool debugLog: false,
}) async {
  Map<String, dynamic> args = <String, dynamic>{};

  if (debugLog) {
    debugPrint('S3 Delete Object Started <--------------');
    debugPrint(" ");
    debugPrint("Object Path: $filePath");
    debugPrint(" ");
  }

  args.putIfAbsent("poolID", () => poolID);
  args.putIfAbsent("region", () => region.region);
  args.putIfAbsent("bucketName", () => bucketName);
  args.putIfAbsent("filePath", () => filePath);
  args.putIfAbsent("debugLog", () => debugLog);
  args.putIfAbsent("subRegion", () => subRegion != null ? subRegion.region : "");

  bool methodResult = await _methodChannel.invokeMethod('delete', args);

  if (methodResult) {
    if (debugLog) {
      debugPrint(" ");
      debugPrint("S3 Delete Completed------------------>");
      debugPrint(" ");
    }
  } else {
    if (debugLog) {
      debugPrint("Status: Error");
      debugPrint(" ");
      debugPrint("S3 Object Deletion Error------------->");
    }
    throw SimpleS3Errors.DeleteError;
  }

  return methodResult;
}