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

Dismissing picker on iPad by clicking outside still awaits and doesn't return null #828

Closed
1 task done
burakomer opened this issue Sep 18, 2021 · 5 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working iOS Issue applies to iOS platform

Comments

@burakomer
Copy link

burakomer commented Sep 18, 2021

Describe the bug
On the iPad simulator, when I initiate the picker, if I click outside of the picker dialog, it dismisses the dialog, but result doesn't return as null, the await part still awaits. When I initiate the picker again, it throws an error that says there's multiple requests, because the first picker still is awaiting even after being dismissed.

Platform

  • iOS (iPadOS)

Platform OS version
What version did it happen?
iOS 14.5

How are you picking?

final pickedFile = await FilePicker.platform.pickFiles(
        allowMultiple: false,
        withData: true,
      );

Details to reproduce the issue
On iPad, call pickFiles with await (async callback in a button).
Dismiss the dialog by tapping outside the dialog.
Call the same pickFiles code.

Error Log

flutter: [MethodChannelFilePicker] Platform exception: PlatformException(multiple_request, Cancelled by a second request, null, null)
[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: PlatformException(multiple_request, Cancelled by a second request, null, null)
#0      StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:597
#1      MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:158
<asynchronous suspension>
#2      MethodChannel.invokeListMethod
package:flutter/…/services/platform_channel.dart:344
<asynchronous suspension>
#3      FilePickerIO._getPath
package:file_picker/src/file_picker_io.dart:87
<asynchronous suspension>
@burakomer burakomer added the new issue An issue that hasn't yet been seen from the maintainer label Sep 18, 2021
@miguelpruivo
Copy link
Owner

Does that happen with a real iPad?

@burakomer
Copy link
Author

burakomer commented Sep 18, 2021

Does that happen with a real iPad?

I don't own one, if someone can test it on a real device I'd like to know.

Edit: By the way I quickly solved it on the simulator with a try catch block, catching the PlatformException with code multiple_request and re-initiating the picker.

@tomwyr
Copy link

tomwyr commented Sep 19, 2021

I experience the exact same problem on simulator iOS 14.5. Same things happen on a real iPhone device.

@miguelpruivo miguelpruivo added bug Something isn't working iOS Issue applies to iOS platform and removed new issue An issue that hasn't yet been seen from the maintainer labels Sep 20, 2021
@miguelpruivo miguelpruivo self-assigned this Sep 20, 2021
miguelpruivo added a commit that referenced this issue Sep 21, 2021
@miguelpruivo
Copy link
Owner

Fixed with 4.1.1. 🎉

Thank you for reporting.

@Liloupar
Copy link

Liloupar commented Nov 30, 2022

it also happen when not clock cancel button, but drag title down to close window.
next try FilePicker.platform.pickFiles will be received the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iOS Issue applies to iOS platform
Projects
None yet
Development

No branches or pull requests

4 participants