Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformException on web #1343

Open
Mobiwoom opened this issue Aug 7, 2023 · 18 comments
Open

PlatformException on web #1343

Mobiwoom opened this issue Aug 7, 2023 · 18 comments
Assignees
Labels
bug Something isn't working feature-candidate This issue might result in a feature to be implemented

Comments

@Mobiwoom
Copy link

Mobiwoom commented Aug 7, 2023

I'm using file_picker: ^5.3.3

Describe the bug
When trying to call await FilePicker.platform.pickFiles() even with type: FileType.any , I get no trouble on dev with flutter, but when going live on production server , now I get PlatformException error only on WEB

my code is simple :
try {
result = await FilePicker.platform.pickFiles(type: FileType.any);
} on PlatformException catch (e) {
print('Unsupported operation' + e.toString());
} catch (e) {
print(e.toString());
}

Error Log
Platform._operatingSystem
Nothing happens when trying to pick files
works well on Android and IOS

anyone found this isse too ?
thanks

@Mobiwoom Mobiwoom added the new issue An issue that hasn't yet been seen from the maintainer label Aug 7, 2023
@Ai-Kiwi
Copy link

Ai-Kiwi commented Aug 9, 2023

I've had the same issue

@Ai-Kiwi
Copy link

Ai-Kiwi commented Aug 10, 2023

issue for me appears on final web build however if you run it as debug or release issue does not appear.

@github-actions
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Aug 18, 2023
@ElsimatAmir
Copy link

still have this issue

@github-actions github-actions bot removed the stale label Aug 19, 2023
@GiYeongUM
Copy link

Try flutter clean and rebuild project.
I hope this will solve the problem

@github-actions
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Aug 30, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@navaronbracke
Copy link
Collaborator

This is a valid issue, since the plugin currently does not set up the platform implementations correctly. I plan on addressing this soon, by migrating the plugin to use plugin_platform_interface like other 1P packages do. cc @miguelpruivo

@sanjaycedti
Copy link

Did you find any solution? I'm facing the same issue. It works well in dev mode but not once it is published.

@navaronbracke
Copy link
Collaborator

There is a workaround using kIsWeb and FilePickerWeb.

That will not be necessary once I am done with my refactor, though.

@yogithesymbian
Copy link

r relea

oh just use

await FilePickerWeb.platform.pickFiles();

instead of

await FilePicker.platform.pickFiles();

@ChaseGuru
Copy link

The documentation says "You are good to go as long as you are on Flutter 2.0 or above." for web. The entire pub.dev page doesn't say anything about FilePickerWeb. The repo example file also just uses a kIsWeb in one spot. So clearly the documentation needs to be updated.

@jan-siroky
Copy link

r relea

oh just use

await FilePickerWeb.platform.pickFiles();

instead of

await FilePicker.platform.pickFiles();

@yogithesymbian This works but then I can't build app on other platforms than Web, any thoughts?

@miguelpruivo Thank you for your hard work. Should we expect this plugin to be updated to work with newest Flutter 3.19 and consequent versions which are gonna drop use of dart:html because of WASM?

@navaronbracke
Copy link
Collaborator

@jan-siroky We can indeed start on migrating to package:web (I have experience in this area, should not be too hard to do).

However, I would like to fix the underlying issue that is made apparent by this bug ticket. We should have a single FilePicker class that provides a platform interface, so that the disambiguation to FilePickerWeb is not even needed for end users. Imo that was a gap in the original API design of this package.

@navaronbracke navaronbracke self-assigned this Mar 13, 2024
@worldgamesdk
Copy link

This should be mentioned in the docs, at least until the underlying issue is fixed.

Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Apr 26, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@navaronbracke navaronbracke added bug Something isn't working and removed new issue An issue that hasn't yet been seen from the maintainer stale labels May 10, 2024
Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label May 18, 2024
@navaronbracke navaronbracke added feature-candidate This issue might result in a feature to be implemented and removed stale labels May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature-candidate This issue might result in a feature to be implemented
Projects
None yet
Development

No branches or pull requests

10 participants