Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.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
Flutter 图像\u选取器未将所选图像保存到缓存文件夹?_Flutter - Fatal编程技术网

Flutter 图像\u选取器未将所选图像保存到缓存文件夹?

Flutter 图像\u选取器未将所选图像保存到缓存文件夹?,flutter,Flutter,我正在使用image_picker 0.7.4拍摄图像,并注意到该文件正在保存到我的应用程序文档目录中,而不是缓存中。这正常吗 getImage() async { ImageSource imageSource; final action = await Dialogs.yesAbortDialog(context, 'Add Photo', 'Where would you like to import a photo from?', 'Camera', '

我正在使用image_picker 0.7.4拍摄图像,并注意到该文件正在保存到我的应用程序文档目录中,而不是缓存中。这正常吗

getImage() async {
    ImageSource imageSource;

    final action = await Dialogs.yesAbortDialog(context, 'Add Photo',
        'Where would you like to import a photo from?', 'Camera', 'Gallery');
    if (action == DialogAction.yes) {
      imageSource = ImageSource.camera;
    } else if (action == DialogAction.no) {
      imageSource = ImageSource.gallery;
    }
    //TODO may need to play with quality settings
    PickedFile selectedFile = await ImagePicker().getImage(
        source: imageSource, imageQuality: 25, maxWidth: 800, maxHeight: 800);

    if (selectedFile != null) {
      setState(() {
        imgs.add(selectedFile.path);
        print(selectedFile.path);
      });
    }
  }
输出

/storage/emulated/0/Android/data/com.ams.mobile_inspections/files/Pictures/scaled_968952ec-d095-4b28-852e-DF5A373F23AE88050656.jpg