flutter_file_picker icon indicating copy to clipboard operation
flutter_file_picker copied to clipboard

PlatformException on web

Open Mobiwoom opened this issue 2 years ago • 18 comments

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 avatar Aug 07 '23 09:08 Mobiwoom

I've had the same issue

Ai-Kiwi avatar Aug 09 '23 19:08 Ai-Kiwi

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

Ai-Kiwi avatar Aug 10 '23 07:08 Ai-Kiwi

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

github-actions[bot] avatar Aug 18 '23 01:08 github-actions[bot]

still have this issue

ElsimatAmir avatar Aug 18 '23 11:08 ElsimatAmir

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

GiYeongUM avatar Aug 22 '23 02:08 GiYeongUM

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

github-actions[bot] avatar Aug 30 '23 01:08 github-actions[bot]

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

github-actions[bot] avatar Sep 13 '23 01:09 github-actions[bot]

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

navaronbracke avatar Oct 09 '23 07:10 navaronbracke

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

sanjaycedti avatar Oct 17 '23 10:10 sanjaycedti

There is a workaround using kIsWeb and FilePickerWeb.

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

navaronbracke avatar Oct 17 '23 10:10 navaronbracke

r relea

oh just use

await FilePickerWeb.platform.pickFiles();

instead of

await FilePicker.platform.pickFiles();

yogithesymbian avatar Oct 20 '23 09:10 yogithesymbian

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.

ChaseGuru avatar Nov 08 '23 21:11 ChaseGuru

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?

jan-siroky avatar Mar 13 '24 12:03 jan-siroky

@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 avatar Mar 13 '24 12:03 navaronbracke

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

worldgamesdk avatar Mar 23 '24 00:03 worldgamesdk

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

github-actions[bot] avatar Apr 26 '24 01:04 github-actions[bot]

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

github-actions[bot] avatar May 10 '24 01:05 github-actions[bot]

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

github-actions[bot] avatar May 18 '24 01:05 github-actions[bot]