deleteImagePath static method

Future<void> deleteImagePath(
  1. List imageFilePath
)

Implementation

static Future<void> deleteImagePath(List imageFilePath) async {
  for (int i = 0; i < imageFilePath.length; i++) {
    try {
      File file = File(imageFilePath[i]);
      if (await file.exists()) {
        await file.delete();
        print('deleteImagePath: ${imageFilePath[i]} => deleted');
      } else {
        print('deleteImagePath: ${imageFilePath[i]} => File not exit');
      }
    } catch (e) {
      print(
          'deleteImagePath: ${imageFilePath[i]} => Error while deleting photo: $e');
    }
  }
}