Skip to content

[Bug]: shareXFiles with XFile.fromData fails on Windows #3432

@Adam-Langley

Description

@Adam-Langley

Platform

Windows

Plugin

share_plus

Version

10.1.3

Flutter SDK

3.27.2

Steps to reproduce

  1. Ensure you are running on Windows (10 or 11)
  2. Create an XFile from data bytes (XFile.fromData)
  3. shareXFiles using this file

(Note: the issue only occurs when using XFile.fromData. XFile(filepath) works fine)

Expected result:
There should be some options displayed, i.e, share via email, etc

Actual result:
The share sheet reads

Try that again
We couldn't show you all the ways you could share.
image

Code Sample

final box = context.findRenderObject() as RenderBox?;
final files = <XFile>[
  XFile.fromData(state.pdfContent, mimeType: 'application/pdf')
];
      
await Share.shareXFiles(
  files,
  sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
  fileNameOverrides: [
    state.filename
  ]
);


### Logs

```shell
No logs necessary

Flutter Doctor

[√] Flutter (Channel stable, 3.27.2, on Microsoft Windows [Version 10.0.26100.2605], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.12.3)
[!] Android Studio (not installed)
[√] VS Code, 64-bit edition (version 1.96.3)
[√] Connected device (2 available)
[√] Network resources

! Doctor found issues in 3 categories.

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions