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

[Bug]: shareUri throws an exception when the share dialog is dismissed #2910

Open
8 tasks done
kbublitz opened this issue May 7, 2024 · 1 comment
Open
8 tasks done
Labels
bug Something isn't working triage

Comments

@kbublitz
Copy link

kbublitz commented May 7, 2024

Platform

Android 12

Plugin

share_plus

Version

9.0.0

Flutter SDK

3.19.6

Steps to reproduce

  1. Use shareLink function
  2. Build flutter app for web target
  3. Run the web app on a mobile phone
  4. Trigger the shareLink function by using a button in the app
  5. Dismiss the share drawer by tapping outside of it

Code Sample

final shareLink = Uri.parse("www.github.com");    
final box = context.findRenderObject() as RenderBox?;
// shareUri seems to work better than share, but does not allow to set a subject for mail
final shareResult = await Share.shareUri(
  shareLink,
  sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);

Logs

Can't run flutter run --verbose on a deployed web app, I see the following error message:

Exception: Navigator.share() failed: The operation was aborted

Flutter Doctor

$ flutter doctor -v
[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.19045.4291], locale de-DE)
    • Flutter version 3.19.6 on channel stable at C:\Users\kbublitz\Tools\flutter   
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (3 weeks ago), 2024-04-17 13:08:03 -0700        
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] VS Code (version 1.90.0-insider)
    • VS Code at C:\Users\kbublitz\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension version 3.89.20240501

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.119
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 124.0.2478.67

[√] Network resources
    • All expected network resources are available.

• No issues found!

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@kbublitz kbublitz added bug Something isn't working triage labels May 7, 2024
@kbublitz
Copy link
Author

kbublitz commented May 7, 2024

My guess is that the following lines from share() should also be added to the shareUri method in the share_plus_web.dart:

if (e.name case 'AbortError') { return _resultDismissed; }

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

No branches or pull requests

1 participant