'save data on windows directory

i'm writing an app that upload and save images from directories of windows to the app. I have write the function to upload the image on the app but I can't find a function to save the image in a determinate folder.

I tried the function of the library file_picker but save only the settings and I have no idea ho to save the image. Can someone help me?

the code:

TextButton(
 onPressed: () async {
    String? newPath = await FilePicker.platform.saveFile(
                fileName: nameFile,
                type: FileType.image,
              );

              FilePickerCross file = FilePickerCross(
                Uint8List.fromList(nameFile.codeUnits),
                path: newPath,
              );

              await file.exportToStorage();
},

update: I found the library file_picker_cross. There's two problems:

  1. when i try to save the app opens the save window twice in a row;

  2. the saved file is as if it were corrupt because show the text "format not supported even if it is a png".



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source