无法以抖动方式检索保存的图像(仅在iOS上可重现该问题)

时间:2019-11-23 13:54:27

标签: flutter flutter-dependencies

我正在使用SQflite保存图像,当我从头开始重新启动应用程序时,无法再次找到图像文件。

下面是供您参考的代码。

  File _storedImage;

  Future<void> _takePicture() async {
    final imageFile = await ImagePicker.pickImage(
      source: ImageSource.gallery,
      maxWidth: 600,
    );
    if (imageFile == null) {
      return;
    }
    setState(() {
      _storedImage = imageFile;
    });
    final appDir = await syspaths.getApplicationDocumentsDirectory();
    final fileName = path.basename(imageFile.path);
    final savedImage = await imageFile.copy('${appDir.path}/$fileName');
    widget.onSelectImage(savedImage);
  }

以下是例外情况详细信息,供您参考。

════════ Exception caught by image resource service ════════════════════════════
The following FileSystemException was thrown resolving an image codec:
Cannot open file, path = '/Users/*****/Library/Developer/CoreSimulator/Devices/C561CB20-67D1-4188-996C-8B06CFB483A9/data/Containers/Data/Application/0A5D4A4F-3B4B-41E5-AFBA-B1A99C2CBFDB/Documents/image_picker_6231C3D6-D4D4-4962-861B-0792D42D2C24-78611-000007A4CC408DD4.jpg' (OS Error: No such file or directory, errno = 2)

When the exception was thrown, this was the stack
#0      _File.open.<anonymous closure>  (dart:io/file_impl.dart:364:9)
(elided 13 frames from package dart:async)
Path: /Users/*****/Library/Developer/CoreSimulator/Devices/C561CB20-67D1-4188-996C-8B06CFB483A9/data/Containers/Data/Application/0A5D4A4F-3B4B-41E5-AFBA-B1A99C2CBFDB/Documents/image_picker_6231C3D6-D4D4-4962-861B-0792D42D2C24-78611-000007A4CC408DD4.jpg

1 个答案:

答案 0 :(得分:0)

Xcode更新似乎已解决了该问题!虽然很奇怪:-P

感谢所有尝试解决此问题的人:)