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

Open dialog for web bug - not picking file if open button is clicked #1197

Closed
isaacclinton opened this issue Dec 25, 2022 · 10 comments
Closed
Labels
new issue An issue that hasn't yet been seen from the maintainer stale

Comments

@isaacclinton
Copy link

Description
FilePicker picks file fine with Windows desktop. However, whenever I run on web(Using windows) to pick a file, after selecting a file, clicking open on the open dialog causes the function to return null (Instead of FilePickerResult). However, double clicking on the file returns the desired result. This might be an issue for users who would prefer clicking open on the open dialog.

Platform
Web

Platform OS version
Windows 11
File Picker: 5.2.3

How are you picking?

final result = await FilePicker.platform.pickFiles(
    allowMultiple: false,
    type: FileType.custom,
    allowedExtensions: ["xlsx"],
    dialogTitle: dialogTitle,
    withData: false,
    withReadStream: true,
  );

print("result == null : ${result == null}");

Details to reproduce the issue
Run flutter for web(Either in debug or release).

Error Log
There is no error

Flutter Version details (Flutter doctor)
[✓] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.22621.900], locale en-US)
• Flutter version 3.3.9 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b8f7f1f986 (5 weeks ago), 2022-11-23 06:43:51 +0900
• Engine revision 8f2221fbef
• Dart version 2.18.5
• DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Isaac\AppData\Local\Android\sdk
• Platform android-33, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.

[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.3.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
• Visual Studio Professional 2022 version 17.3.32929.385
• Windows 10 SDK version 10.0.22000.0

[✓] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2021.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.2
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.74.2)
• VS Code at C:\Users\Isaac\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0

[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.900]
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.125
• Edge (web) • edge • web-javascript • Microsoft Edge 107.0.1418.62

[✓] HTTP Host Availability
• All required HTTP hosts are available

Additional context
Add any other context about the problem here.

@isaacclinton isaacclinton added the new issue An issue that hasn't yet been seen from the maintainer label Dec 25, 2022
@lwx123
Copy link

lwx123 commented Dec 27, 2022

I had the same problem,I am looking forward to solving it

@lwx123
Copy link

lwx123 commented Dec 29, 2022

i found it ,
https://github.com/miguelpruivo/flutter_file_picker/blob/master/lib/_internal/file_picker_web.dart

void changeEventListener(e) {
      if (changeEventTriggered) {//**it is true**
        return;
      }
      changeEventTriggered = true;
.....
}

void cancelledEventListener(_) {
      window.removeEventListener('focus', cancelledEventListener);

      // This listener is called before the input changed event,
      // and the `uploadInput.files` value is still null
      // Wait for results from js to dart
      Future.delayed(Duration(milliseconds: 500)).then((value) {
        if (!changeEventTriggered) {
          changeEventTriggered = true;
          filesCompleter.complete(null);
        }
      });
    }

    uploadInput.onChange.listen(changeEventListener);
    uploadInput.addEventListener('change', changeEventListener);

    // Listen focus event for cancelled
    window.addEventListener('focus', cancelledEventListener);
......
}

@getr11
Copy link

getr11 commented Dec 29, 2022

This timeout can also be reached on slow networks. I encountered sporadic problems where no result is returned even files are picked because this limit is reached on a slow network (NetworkShare, ....).

@GelistirmeKF
Copy link

Hi, is there any exact solution for this issue?

Thanks

@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 Jan 11, 2023
@athornboroughp4
Copy link

Having similar issues, seems to be a common thread among other issues on here.

Seems to be related to the following issues:

May have been caused by:
With the timeout issue.

@miguelpruivo any thoughts on this? Seems like a bug after selecting the file, and the 500 ms delay is not enough. I have seen it take up to 10/15 seconds but I am not sure what is happening behind the scenes.

I know you are busy so I appreciate you taking a look at my comment.

@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 Jan 28, 2023
@github-actions
Copy link

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

@guidotheelen
Copy link
Contributor

Still an issue for me. This bug renders the FilePicker useless on several machines.

@djcali570
Copy link

I am having this issue also. Any workarounds yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new issue An issue that hasn't yet been seen from the maintainer stale
Projects
None yet
Development

No branches or pull requests

7 participants