alexrintt / shared-storage

Flutter plugin to work with Android external storage.
http://alexrintt.io/shared-storage/
MIT License
54 stars 26 forks source link

No feedback when the user doesn't select a folder #13

Closed dangilbert closed 2 years ago

dangilbert commented 2 years ago

I'm trying to show the user an alert when they haven't selected a folder to let them know their file won't be downloaded, but in the case that no URI is returned from the document tree in openDocumentTree, nothing is sent back to flutter.

I don't know whether it makes sense to do something like pendingResult.second.success(null) (or even pass the uri regardless of whether it is null) or to return an error case that would need to be handled in flutter, such as an error saying that no folder was chosen.

If you have a preference I'm happy to open a PR against this.

I'm trying to make use of the latest version from master at the moment as I needed access to some of the code as-yet unreleased on pub.dev.

Thanks!

alexrintt commented 2 years ago

Thanks for the issue! As you described, seems like the native never returns when the user don't pick a folder, right?

I think the solution is to return null when it happens since it's not a error itself but a user choice

If you want, feel free to open the PR! If I could help to answer questions, let me know

Thanks again!

daentech commented 2 years ago

Having that merged has solved my problem, thanks. I don't appear to be able to mark the issue as resolved.

Are you planning on publishing an updated version to pub.dev any time soon? Is there anything I can do to help? (I'm hoping to make use of the SAF stuff in a project and couldn't work out how to use the copy method)