Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageGallerySaver.saveFile creates 2 files. #305

Open
Dogukan-2 opened this issue Jul 29, 2024 · 0 comments
Open

ImageGallerySaver.saveFile creates 2 files. #305

Dogukan-2 opened this issue Jul 29, 2024 · 0 comments

Comments

@Dogukan-2
Copy link

I am trying to view the image saved locally in the gallery. My codes are below;

   Uint8List pngBytes = await _qrToImage();
      //await ImageGallerySaver.saveImage(pngBytes);
      final Directory picturesDir = (await getExternalStorageDirectory())!;
      final Directory dir =
          Directory('${picturesDir.path}/Pictures/Test');
      if (!(await dir.exists())) {
        await dir.create(recursive: true);
      }

      // Save IMG
      final String filePath = '${dir.path}/$defaultFileName.jpeg';
      final File file = File(filePath);
      await file.writeAsBytes(pngBytes);

      // Add gallery
      await ImageGallerySaver.saveFile(filePath);

This code saves the image to the location I specified. However, it creates the same file again under the "Pictures" directory. As a result, the file shown in the gallery is the one under "Pictures," not the one I saved. Therefore, if I delete the image from the gallery, the image at the path I specified is not deleted, so my app still thinks the image exists. The main issue is: How can I ensure that the saveFile function only saves the file to the path I specify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant