deleteImageByHash<DataT extends Data> method

Future<String?> deleteImageByHash<DataT extends Data>(
  1. DataT? data,
  2. String hash, {
  3. Data? caller,
  4. bool forceUpdate = false,
})

deletes an image specified by its hash and returns the response

Implementation

Future<String?> deleteImageByHash<DataT extends Data>(
  DataT? data,
  String hash, {
  Data? caller,
  bool forceUpdate = false,
}) async {
  //offline procedure, needs some stuff changed and added..
  if ((forceUpdate || caller != null) && data != null) {
    try {
      // data.id = /*'_oe_' + */ createLocalId(data);
      // await OP.deleteImage(hash); //TODO: delete image from disk, such that when 'hochsyncen' it is not uploaded and the 'hochsync' is not interrupted (which it would be if it just tries to upload a file that is now deleted)
      data.imagehashes!.remove(hash);
      await storeData<DataT>(data, forId: caller?.id ?? await API().rootID);
      // return 'successfully deleted image offline';
    } catch (e) {
      debugPrint('failed to remove image locally');
    }
  }
  return null;
}