I am using share_plus
package and I used to be able to share pdf with ease. But since 3.27.3 flutter sdk update the Share file calls are getting crashed on all Android version except Android 15 emulator (Which hardly any of my app users currently use).
cartPdfShare custom action ->
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
Future cartPdfShare(FFUploadedFile pdfDoc) async {
// Add your function code here!
// Get temporary directory
final directory = await getTemporaryDirectory();
String fileName = pdfDoc.name!;
// Create a temporary file
final tempFile = File('${directory.path}/$fileName');
// Write PDF data to the file
await tempFile.writeAsBytes(pdfDoc.bytes!);
// Share the file
await Share.shareXFiles([XFile(tempFile.path)], text: 'Invoice: $fileName');
}