clearImage method

Future<void> clearImage()

Implementation

Future<void> clearImage() async {
  String path = (await getTemporaryDirectory()).path;
  File file = File('$path/cropped_image.png');
  if (await file.exists()) {
    imageCache.clear();
    imageCache.evict(FileImage(File('$path/cropped_image.png')));
    await file.delete();
    debugPrint('File deleted');
  } else {
    debugPrint('File not found');
  }
}