You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue Summary
When using the file_picker package on the Web platform, selecting an image from a OneDrive folder results in a FilePickerResult containing a PlatformFile object with bytes set to null. This makes it impossible to access the content of the selected file for further use, such as displaying the image.
Steps to Reproduce
Use the FilePicker.platform.pickFiles method on the web platform (e.g., Chrome).
Select an image from the OneDrive folder.
Observe that the returned PlatformFile contains metadata (name, size) but has bytes and readStream as null. Sample Code:
final result =awaitFilePicker.platform.pickFiles(
allowMultiple:false,
type:FileType.custom,
allowedExtensions:<String>[
'jpg',
'png',
],
);
if (result !=null) {
print(result.files.first.bytes); // Outputs: null
}
Observed Behavior
The PlatformFile object returned has the following structure: PlatformFile(name: logo.png, bytes: null, readStream: null, size: 388400)
Both bytes and readStream are null, making it impossible to use the file's content. Expected Behavior
The PlatformFile.bytes field should contain the file's content as a byte array when selecting a file from the OneDrive folder, as it does for other folders.
Additional Details
Version Used:
Issue persists on both 8.0.0+1 and the latest version, 8.1.4.
Reproducibility:
Tested on Chrome browser on both MacOS and Windows platforms.
Attempts to Resolve:
Adding withData: kIsWeb to the pickFiles call did not resolve the issue.
Testing in Example Project:
Cloned the example project from GitHub repository.
Added the following code to reveal the issue clearly:
returnListTile(
title:Text(name),
subtitle:Text(path ??'bytes: ${_paths?.firstOrNull?.bytes}'), // <<< added this, because on web `path` is null.
);
Confirmed that the bytes field is null for files selected from the OneDrive folder. Notes
The README shows an example for Windows where files from OneDrive are selected successfully, suggesting this behavior is unexpected.
Screen.Recording.2024-11-18.at.4.32.29.PM.mov
The text was updated successfully, but these errors were encountered:
Issue Summary
When using the
file_picker
package on the Web platform, selecting an image from a OneDrive folder results in aFilePickerResult
containing aPlatformFile
object with bytes set tonull
. This makes it impossible to access the content of the selected file for further use, such as displaying the image.Steps to Reproduce
Use the
FilePicker.platform.pickFiles
method on the web platform (e.g., Chrome).Select an image from the OneDrive folder.
Observe that the returned
PlatformFile
contains metadata (name
,size
) but hasbytes
andreadStream
asnull
.Sample Code:
Observed Behavior
The
PlatformFile
object returned has the following structure:PlatformFile(name: logo.png, bytes: null, readStream: null, size: 388400)
Both
bytes
andreadStream
are null, making it impossible to use the file's content.Expected Behavior
The
PlatformFile.bytes
field should contain the file's content as a byte array when selecting a file from the OneDrive folder, as it does for other folders.Additional Details
Issue persists on both 8.0.0+1 and the latest version, 8.1.4.
Tested on Chrome browser on both MacOS and Windows platforms.
withData: kIsWeb
to thepickFiles
call did not resolve the issue.Cloned the example project from GitHub repository.
Added the following code to reveal the issue clearly:
Confirmed that the
bytes
field is null for files selected from the OneDrive folder.Notes
The README shows an example for Windows where files from OneDrive are selected successfully, suggesting this behavior is unexpected.
Screen.Recording.2024-11-18.at.4.32.29.PM.mov
The text was updated successfully, but these errors were encountered: