Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 图像库保护程序锁定主线程抖动_Image_Flutter_Gallery - Fatal编程技术网

Image 图像库保护程序锁定主线程抖动

Image 图像库保护程序锁定主线程抖动,image,flutter,gallery,Image,Flutter,Gallery,我用这个插件来捕获图像,在图像捕获后,我用这个插件将图像保存到了图库中。我的问题是,当图像库保护程序将图像保存到库中时,它会将主UI线程锁定一段时间,而我的相机在几秒钟内没有响应。我想连续拍摄图像。我使用了隔离和计算,但它不能工作。我认为图像库保护程序只适用于主线程。将图像保存到gallery并连续捕获图像的最佳方法是什么?还有其他方法吗 我试过这个 saveToLocale(Uint8List bytes) async { compute(ImageGallerySaver.saveImage

我用这个插件来捕获图像,在图像捕获后,我用这个插件将图像保存到了图库中。我的问题是,当图像库保护程序将图像保存到库中时,它会将主UI线程锁定一段时间,而我的相机在几秒钟内没有响应。我想连续拍摄图像。我使用了隔离和计算,但它不能工作。我认为图像库保护程序只适用于主线程。将图像保存到gallery并连续捕获图像的最佳方法是什么?还有其他方法吗

我试过这个

saveToLocale(Uint8List bytes) async {
compute(ImageGallerySaver.saveImage, bytes);
}
还有这个

saveToLocale(Uint8List bytes) async {
ImageGallerySaver.saveImage(bytes).then((result) {});
}
解决了我的问题。它可以在不锁定主UI线程的情况下工作

Future<void> saveToLocale(String url) async {
  await GallerySaver.saveImage(url, albumName: "Abc");
}
Future saveToLocale(字符串url)异步{
等待GallerySaver.saveImage(url,albumName:“Abc”);
}