Closed tannermeade closed 2 years ago
This issue is stale because it has been open for 14 days with no activity.
Hi, just my 2 cents. I'm having issues like this using both Flutter Desktop for MacOS (using a MBP M1) and Flutter Web.
In my case I've detected that first open usually works but subsequent tries freezes.
As a workaround I've implemented a Drag&Drop zone. It's not perfect but it works as a replacement.
This issue is stale because it has been open for 14 days with no activity.
@peacememories: my following answer applies to your issue #964 as well.
@tannermeade: thank you for reporting this issue and for using our issue template. As you already figured out, there's a similar issue #964.
You mentioned that your issue would be related to #778, but you're clearly describing an issue with the desktop implementation of file_picker
on macOS. However, issue #778 was related to the iOS device simulator. So I think that these are different problems.
Since I don't own a physical Apple device, let alone a MacBook with M1 processor, I'm afraid that I can't help you with your reported issue. I just tried again with our latest version, file_picker
works fine on the virtual device I am testing on. There are two ways how you could help yourself:
You could debug our fairly simple implementation for macOS (see https://github.com/miguelpruivo/flutter_file_picker/blob/master/lib/src/file_picker_macos.dart). Basically, to open any kind of dialog on macOS, we simply execute a shell command. This is obviously not the professional approach (PRs are welcome). For instance, for opening the file picker, we execute:
osascript -e 'choose file of type {"csv"} with multiple selections allowed'
You can copy paste this command to a terminal to try it out. In summary, our equivalent Dart code looks like this:
final executable = '/usr/bin/osascript';
final arguments = [ '-e', 'choose file of type {"csv"} with multiple selections allowed' ];
final processResult = await Process.run(executable, arguments);
print(processResult.stdout?.toString().trim());
If file_picker
freezes while executing this shell command, then it must be related to Flutter or macOS itself. We already had the issue on Ubuntu, that Flutter had no permissions to execute the shell command (when installed via snap). In this case, the file picker dialog didn't open up at all. Your issue is different. Please keep me posted, if you debug it and find out anything.
You could switch to a more professional C++ implementation that doesn't use shell commands. Google provides its own Flutter plugin file_selector and file_selector_macos. Google says that their plugin has not yet been endorsed because it is impossible to write UI tests for their plugin (same applies to file_picker
).
And yes, I can confirm that the file picker dialog takes 1-2 seconds to open. At least in my case, this delay is due to using a virtualized macOS device and still I don't have to wait 3-4 seconds. Also, the dialog never freezes or crashes even if I repeat the same procedure up to five times:
I'm sorry that I can't help you any further.
@philenius thank you for the detailed help. I haven't been able to get it to freeze with just the command. I'll have to figure out how to debug it further and your direction is helpful for that. Thank you!
@tannermeade I'm also on M1 mac and I have the same issue sometimes. Do you have any idea how can I solve this issue.
This issue is stale because it has been open for 14 days with no activity.
I too have run in to this issue when moving from Intel Mac to M1 Mac. It appears that this issue arises when starting the application from Flutter (VS Code). If you run the same project in Xcode there is no issue. Perhaps worth filing a bug with the Flutter team, it might not be an issue with the plugin.
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.
Please stop the stale bot from closing unresolved issues. I ran into this from time to time on an M1 when doing:
FilePicker.platform.getDirectoryPath()
Please stop the stale bot from closing unresolved issues. I ran into this from time to time on an M1 when doing:
FilePicker.platform.getDirectoryPath()
@philenius answer was pretty straight forward. Neither I or him can't provide any help regarding this at the moment because seems like we both don't own M1 Macs and makes it harder to replicate or even diagnose what can be done in order to prevent/fix it.
Anyone with a M1 Mac experiencing this issue, is welcome to contribute and issue a PR with a fix for it.
M1 Pro user here, had the issue as well but it does not seem to happen anymore on the current beta channel of flutter (2.13-pre as I speak).
I am having this issue as well. I am amble to consistently reproduce the issue when calling getDirectoryPath
if finder is open in the path to the default path of getDirectoryPath
unfortunately up to this point I haven't been able to debug the actual issue, I am still troubleshooting but I am curious to see if others are able to reproduce in a similar way
This issue is stale because it has been open for 14 days with no activity.
I was able to reproduce it by calling pickFiles in an onTap function of a GestureDetector. But it only freezes if the initial directory is Recents.
Another way to reproduce it is if you call the pickFiles with the onTap Function of the GestureDetector and spam click it, but that obviously does make more sense. ^^
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.
hello, any solution for freezing?
Describe the bug File picker freezes often on macOS M1 devices on v 4.3.3 (and many versions before). This issue (https://github.com/miguelpruivo/flutter_file_picker/issues/778) should be reopened or this new issue should be used to track it.
Platform
Platform OS version What version did it happen? Several versions, but confirmed on macOS 11.6 (20G165)
How are you picking?
Details to reproduce the issue On an M1 macOS, use the FilePicker in most any way, specifically you can use multiple files and only allow CSV and it freezes often.
Error Log The app freezes. For a few seconds, the cursor stays as a click cursor until it turns to the turning beachball. Only way to stop it is to force close the app or stop the run time.
Screenshots and/or video If applicable, add screenshots or video to help explain your problem.
Flutter Version details Has happened on several channels for a long time and the last several versions of Flutter, but here is my current doctor:
Additional context This issue has been reported several times in this issue: https://github.com/miguelpruivo/flutter_file_picker/issues/778