flutter_file_picker
flutter_file_picker copied to clipboard
PlatformException on web
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
I've had the same issue
issue for me appears on final web build however if you run it as debug or release issue does not appear.
This issue is stale because it has been open for 14 days with no activity.
still have this issue
Try flutter clean and rebuild project.
I hope this will solve the problem
This issue is stale because it has been open for 14 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
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
Did you find any solution? I'm facing the same issue. It works well in dev mode but not once it is published.
There is a workaround using kIsWeb and FilePickerWeb.
That will not be necessary once I am done with my refactor, though.
r relea
oh just use
await FilePickerWeb.platform.pickFiles();
instead of
await FilePicker.platform.pickFiles();
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.
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 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.
This should be mentioned in the docs, at least until the underlying issue is fixed.
This issue is stale because it has been open for 7 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
This issue is stale because it has been open for 7 days with no activity.