My save image method:
_saveScreen() async {
RenderRepaintBoundary boundary =
_globalKey.currentContext.findRenderObject();
ui.Image image = await boundary.toImage();
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
final result =
await ImageGallerySaver.saveImage(byteData.buffer.asUint8List());
imageDateList.add('${dateTime.day}.${dateTime.month}.${dateTime.year}');
prefs.setStringList('imageDateList', imageDateList);
Navigator.of(context).pop();
String tmpStringHolder =
result.toString().split('storage')[1].split(',')[0];
photoData.addPhoto('storage$tmpStringHolder');
_toastInfo(result.toString());
}
I'm using these packages to write and read image file :
image_picker: ^0.6.0+3
permission_handler: ^5.0.1+1
image_gallery_saver: ^1.6.7
path_provider: ^1.5.1+1
My project was working perfectly when my app name doesn't have whitespace in its name.
Now I get this error when I try to load my images:
'storage/emulated/0/Buttocks%20leg/1611320083489.jpg' (OS Error: No such file or directory, Errno = 2)
I try to use other packages but I can't find any solution for this. And I tried to read a path like this but that doesn't work too.
Image.file(File('"storage/emulated/0/Buttocks leg/1611553265363.jpg"')),
As you can see above the way I tried. I get this error when I try this :
Cannot open file, path = '"storage/emulated/0/Buttocks leg/1611553265363.jpg"' (OS Error: No such file or directory, errno = 2)
I have to read the file path that contains whitespace in its name, how can I do that?
question from:
https://stackoverflow.com/questions/65879772/how-to-read-a-file-path-that-contains-whitespace 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…