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]: shareXFiles with XFile.fromData fails on Windows #3432

Open
8 tasks done
Adam-Langley opened this issue Jan 14, 2025 · 1 comment
Open
8 tasks done

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

Adam-Langley opened this issue Jan 14, 2025 · 1 comment
Labels
bug Something isn't working triage

Comments

@Adam-Langley
Copy link

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
@Adam-Langley Adam-Langley added bug Something isn't working triage labels Jan 14, 2025
@miquelbeltran
Copy link
Member

FYI, a refactor on how share works is in progress in here #3404

If you want to debug this issue, take a look at the file share_plus_platform_interface/lib/method_channel/method_channel_share.dart and see if the _getFiles() get created correctly.

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

2 participants