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

Cancel picking a file and then pick again throws an error and breaks the app #20

Closed
pushangupta opened this issue Dec 23, 2018 · 6 comments
Labels
triage Further information is requested

Comments

@pushangupta
Copy link

pushangupta commented Dec 23, 2018

Try to cancel the first request of picking the file and then reopen the file picker. It throws a Platform Exception which, is not being caught in PlatformException


    Future getBrochure() async {
    try {
      await FilePicker.getFilePath(type: FileType.ANY)
          .catchError((error) => print(error))
          .then((brochure_path) {
            print("Completed");
        if (brochure_path != "" || brochure_path != null) {
          print("fired");
          setState(() {
            brochure = File(brochure_path);
          });
        }
      });
    } on PlatformException catch (e) {
      print(e);
    }
  }
@miguelpruivo miguelpruivo added bug Something isn't working triage Further information is requested labels Dec 26, 2018
@miguelpruivo
Copy link
Owner

miguelpruivo commented Dec 26, 2018

@pushangupta I've tried to re-create your issue even with your code and I can't seem to be able to replicate. Everything seems to be fine. Would you mind to add some logs?

@miguelpruivo miguelpruivo removed the bug Something isn't working label Dec 26, 2018
@pushangupta
Copy link
Author

@miguelpruivo

screen shot 2018-12-27 at 12 08 54 am
screen shot 2018-12-27 at 12 09 15 am

These are logs after running on IOS simulator

@pushangupta
Copy link
Author

pushangupta commented Dec 26, 2018

@miguelpruivo I think your ios delegate file misses to hit the "canceled by the user" case.
Actually I have narrowed it down.

The problem what I think is, when you cancel choosing the file, the request isn't terminated. So the asynchronous request is still in the memory and when we try to shoot the second request, conflict occurs.

@miguelpruivo
Copy link
Owner

Thank you @pushangupta I've found the issue and it is already solved in the beta. I'm looking to release a new version to dart pub soon with this fixed and also new features such as custom file type filtering (between today and tomorrow).

@pushangupta
Copy link
Author

@miguelpruivo Glad to hear that. I am really looking forward for your release. Keep it up!

@miguelpruivo
Copy link
Owner

Released. See changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants