Skip to content

[Question]: Unhandled Exception: PlatformException(Share callback error, prior share-sheet did not call back, did you await it? Maybe use non-result variant, null, null) #2461

@llyl

Description

@llyl

What is your question?

I use flutter version 3.16.3. flutter doctor and everything other is ok.

Here is some brief codes:
String dir = (await getTemporaryDirectory()).path;
String saveFileName = user.userName.replaceAll('/', '_')+ Constant.SAVE_FORMAT;
File saveFile = File('$dir/$saveFileName' );
Share.shareXFiles([XFile(saveFile.path)], text: 'sharing');

Here is the error log:
I/flutter ( 8533): parent: /storage/emulated/0/Android/data
I/flutter ( 8533): /storage/emulated/0/Android/data/com.tencent.mm/MicroMsg/Download
I/flutter ( 8533): delFile: /storage/emulated/0/Android/data/com.tencent.mm/MicroMsg/Download/B.E.G. DALI-LINK.beglnk
E/flutter ( 8533): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Share callback error, prior share-sheet did not call back, did you await it? Maybe use non-result variant, null, null)
E/flutter ( 8533): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
E/flutter ( 8533): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322:18)
E/flutter ( 8533):
E/flutter ( 8533): #2 MethodChannelShare.shareFilesWithResult (package:share_plus_platform_interface/method_channel/method_channel_share.dart:140:9)
E/flutter ( 8533):

Checklist before submitting a question

  • 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 am 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

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions