imagefluttergallery

Image gallery saver lock the main thread flutter


I'm used Camera plugin for capture image and after image captured I saved image to gallery using image_gallery_saver. My problem is that when Image Gallery Saver save the image to gallery it locked the main UI thread for some time and my camera not response for some seconds. I want to capture images continuously. I used isolate and compute but it's not woking with it. I think Image Gallery Saver work only main thread. What is the best way to save image to gallery and capture images continuously or any other alternative is there?

I tried with this

saveToLocale(Uint8List bytes) async {
compute(ImageGallerySaver.saveImage, bytes);
}

and this

saveToLocale(Uint8List bytes) async {
ImageGallerySaver.saveImage(bytes).then((result) {});
}

Solution

  • gallery_saver solved my probleam. Its work without locking the main UI thread

    Future<void> saveToLocale(String url) async {
      await GallerySaver.saveImage(url, albumName: "Abc");
    }