【发布时间】:2019-11-15 20:56:59
【问题描述】:
我正在开发一个产品信息应用程序,我需要分享产品的规范 PDF,有什么办法吗?我使用包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,
),
),);
}
【问题讨论】:
-
添加一些关于如何共享数据的代码
-
@Ggriffo 我已经更新了我的代码。
-
[update] 摆脱问题聊天 flutter clean 然后获取包,升级包,
-
它不起作用,我删除了它。感谢您的回复。