我正在尝试调用此功能以打开相机并将拍摄的照片保存为抖动。该功能运行良好并且相机已打开,但是当我尝试保存图像时,它始终将图像文件保存在数据内部的应用程序目录中,而不是将其保存在外部位置。 我该如何解决这个错误?
Future openCameraAndSaveImage(BuildContext context) async {
File _image;
final File capturedImage = await ImagePicker.pickImage(
source: ImageSource.camera,
);
final dir = await getExternalStorageDirectory();
final String path = dir.path;
final File finalImage = await capturedImage.copy('$path/image1.png');
setState() {
_image = finalImage;
}
setState();
AlertDialog dialog = new AlertDialog(
content: new Container(
child: new Text("Image Saved in" + path),
),
);
showDialog(context: context, child: dialog);
}