Skip to content

[Bug]: Share_plus Web Must be handling a user gesture to perform a share request #3609

Open
@FabioCFonseca

Description

@FabioCFonseca

Platform

chrome

Plugin

share_plus

Version

11.0.0

Flutter SDK

3.32.2

Steps to reproduce

I'm trying to share a link locally in Flutter web (Chrome) by adding a BLoC event that calls the share service. It works on Android and iOS, but on the web, I encounter the following exception:

[log] Failed to share URI
[log] NotAllowedError: Failed to execute 'share' on 'Navigator': Must be handling a user gesture to perform a share request.
[log] Navigator.share() failed: Failed to execute 'share' on 'Navigator': Must be handling a user gesture to perform a share request.

How can I resolve this exception?

Code Sample

Logs

[log] Failed to share uri
[log] NotAllowedError: Failed to execute 'share' on 'Navigator': Must be handling a user gesture to perform a share request.
[log] Navigator.share() failed: Failed to execute 'share' on 'Navigator': Must be handling a user gesture to perform a share request.

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.2, on macOS 14.4.1 23E224 darwin-arm64, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.97.2)
[✓] Connected device (3 available)
[✓] Network resources

• 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions