Skip to content

[Request]: Allow uri + text together in ShareParams (for iOS support) #3748

@tybens

Description

@tybens

Plugin

share_plus

Use case

Current Behavior

await SharePlus.instance.share(
 ShareParams(
  text: 'Check this out!'
   uri: Uri.parse(
    'https://example.com/page/123'
  ),
),

Results in

Invalid argument(s): uri and text cannot be provided at the same time

I see this restriction was added in #3404 (comment) as a deliberate design choice. The discussion mentions being open to revisiting based on feedback :)

Feature request

I want to share a URL with a custom pre-filled message. Such that if a user clicks "iMessage" the custom text will be appended underneath the rich link preview.

iOS supports this natively - you just pass both to UIActivityViewController:

  UIActivityViewController(activityItems: ["Check this out!", url], applicationActivities: nil)

Proposal

Remove the restriction so iOS and make the small native code change for iOS to work. I've tested it and it works with minimal changes.

For non-iOS functionality (e.g. Android Intent.EXTRA_TEXT only has one slot ), we could either:

  • Fall back to uri-only
  • Concatenate them
  • Document the platform difference

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions