Hi, I am working on an app. Inside the app user picks a file and it get copied to cache and then manipulation are applied. Before saving its multiple versions to selected directory. Plugin works fine when a single is saved but whenever multiple SaveFileInfo objects are passed to the saveFiles[] array inside the FileSaverParams, it saves all the files that are present in the cache memory. Also it ignored the names as well.
Here is the function that is used to save multiple files. :
Future<List<String>?> SaveMulti(String path) async{
List<String>? result;
result = await PickOrSave().fileSaver(
params: FileSaverParams(
saveFiles: [
SaveFileInfo(
filePath: path,
fileName: "file.pdf",
),
SaveFileInfo(
filePath: path,
fileName: "file_2.pdf",
),
],
)
);
return result;
}
For the sake of example, the same path is used for both files. The paths could be different in production for each files.
Here is the log output that is generated:
D/PickOrSavePlugin(15029): onMethodCall - IN , method=pickFiles
D/PickOrSave(15029): pickFile - IN, allowedExtensions=[], mimeTypesFilter=[], localOnly=false, copyFileToCacheDir=true, pickerType=File, enableMultipleSelection=false
D/PickOrSavePlugin(15029): pickFile - OUT
I/System.out(15029): Elapsed time in nanoseconds: 7622200
D/EGL_emulation(15029): eglMakeCurrent: 0xec6610e0: ver 3 0 (tinfo 0xd5734090)
I/System.out(15029): Elapsed time in nanoseconds: 311600
D/PickOrSavePlugin(15029): Picked file: content://com.android.externalstorage.documents/document/primary%3APdfs%2Fhih.pdf
D/PickOrSavePlugin(15029): Launch...
D/PickOrSavePlugin(15029): Copy on background...
D/PickOrSavePlugin(15029): Copying 'content://com.android.externalstorage.documents/document/primary%3APdfs%2Fhih.pdf' to '/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf'
D/PickOrSavePlugin(15029): Successfully copied file to '/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf, bytes=1739242'
D/EGL_emulation(15029): eglMakeCurrent: 0xec605f40: ver 3 0 (tinfo 0xd2c75730)
D/EGL_emulation(15029): eglMakeCurrent: 0xec605f40: ver 3 0 (tinfo 0xd2c75730)
D/PickOrSavePlugin(15029): ...copied on background, result: /data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf
D/PickOrSavePlugin(15029): ...launch
I/System.out(15029): filePicking result cleared
I/System.out(15029): Elapsed time in nanoseconds: 184008400
D/EGL_emulation(15029): eglMakeCurrent: 0xec6610e0: ver 3 0 (tinfo 0xd5734090)
D/PickOrSavePlugin(15029): onMethodCall - IN , method=saveFiles
D/PickOrSave(15029): saveFile - IN, saveFiles=[SaveFileInfo(filePath=/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf, fileData=null, fileName=file.pdf), SaveFileInfo(filePath=/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf, fileData=null, fileName=file_2.pdf)], mimeTypesFilter=[], localOnly=false
D/PickOrSavePlugin(15029): saveFile - OUT
I/System.out(15029): Elapsed time in nanoseconds: 18574800
D/EGL_emulation(15029): eglMakeCurrent: 0xec6610e0: ver 3 0 (tinfo 0xd5734090)
E/eglCodecCommon(15029): goldfish_dma_create_region: could not obtain fd to device! fd 0 errno=11
I/System.out(15029): Elapsed time in nanoseconds: 229000
D/PickOrSavePlugin(15029): Saving file on background...
D/PickOrSavePlugin(15029): hih.1965357157916328852
D/PickOrSavePlugin(15029): Saving file '/data/user/0/com.example.test_j/cache/hih.1965357157916328852.pdf' to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (2).pdf'
D/PickOrSavePlugin(15029): Saved file to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (2).pdf'
D/EGL_emulation(15029): eglMakeCurrent: 0xec605f40: ver 3 0 (tinfo 0xd2c75730)
D/EGL_emulation(15029): eglMakeCurrent: 0xec605f40: ver 3 0 (tinfo 0xd2c75730)
D/EGL_emulation(15029): eglMakeCurrent: 0xec6610e0: ver 3 0 (tinfo 0xd5734090)
D/PickOrSavePlugin(15029): hih.1965357157916328852
D/PickOrSavePlugin(15029): Saving file '/data/user/0/com.example.test_j/cache/hih.1965357157916328852.pdf' to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (3).pdf'
D/PickOrSavePlugin(15029): Saved file to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (3).pdf'
D/PickOrSavePlugin(15029): hih.2272588982937325117
D/PickOrSavePlugin(15029): Saving file '/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf' to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117.pdf'
D/PickOrSavePlugin(15029): Saved file to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117.pdf'
D/PickOrSavePlugin(15029): hih.2272588982937325117
D/PickOrSavePlugin(15029): Saving file '/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf' to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117 (1).pdf'
D/PickOrSavePlugin(15029): Saved file to '/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117 (1).pdf'
D/PickOrSavePlugin(15029): ...saved file on background, result: [/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (2).pdf, /tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (3).pdf, /tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117.pdf, /tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117 (1).pdf]
I/System.out(15029): fileSaving result cleared
I/System.out(15029): Elapsed time in nanoseconds: 302553100
In the above log, it seems saveFiles[] has correct information about the files but
[SaveFileInfo(filePath=/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf, fileData=null, fileName=file.pdf), SaveFileInfo(filePath=/data/user/0/com.example.test_j/cache/hih.2272588982937325117.pdf, fileData=null, fileName=file_2.pdf)],
Instead of saving those two file it saves all the files from cache(that what look like happens):
[/tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (2).pdf, /tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.1965357157916328852 (3).pdf, /tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117.pdf, /tree/primary:Pdfs/pagecount/Test/document/primary:Pdfs/pagecount/Test/hih.2272588982937325117 (1).pdf]
Any idea why it is happening.
Thanks.
Hi, I am working on an app. Inside the app user picks a file and it get copied to cache and then manipulation are applied. Before saving its multiple versions to selected directory. Plugin works fine when a single is saved but whenever multiple SaveFileInfo objects are passed to the saveFiles[] array inside the FileSaverParams, it saves all the files that are present in the cache memory. Also it ignored the names as well.
Here is the function that is used to save multiple files. :
For the sake of example, the same path is used for both files. The paths could be different in production for each files.
Here is the log output that is generated:
In the above log, it seems saveFiles[] has correct information about the files but
Instead of saving those two file it saves all the files from cache(that what look like happens):
Any idea why it is happening.
Thanks.