[英]Flutter: How to share PDF file to built inn apps like Whatsapp or email
我正在开发一个产品信息应用程序,我需要分享产品的规格 PDF,有什么办法吗? 我使用 package share_extend
但是在使用它时出现异常
E/flutter (11283): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method share on channel com.zt.shareextend/share_extend)
E/flutter (11283): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)
这是我的代码
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
tooltip: 'Share File',
onPressed: () async {
var dir = await getApplicationDocumentsDirectory();
File file = File('${dir.path}/${widget.product}.pdf');
if (!await file.exists()) {
await file.create(recursive: true);
file.writeAsStringSync("test for share documents file");
}
ShareExtend.share(file.path, "file");
},
backgroundColor: Color(0xffECECEC),
child: Icon(
Icons.share,
color: Color(0xff6F6F6F),
size: 30.0,
),
),);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.